< a href>围绕< asp:imagebutton>不工作 - 需要一些帮助 [英] <a href> around an <asp:imagebutton> not working - need some help

查看:75
本文介绍了< a href>围绕< asp:imagebutton>不工作 - 需要一些帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML表格,其中包含以下几个字段:


< A href =" Savings.aspx?category = Food">< asp:imagebutton id = imgFood

ImageUrl =" images\buttons\btn-food-i.gif" runat =" server">< / asp:imagebutton>< / A>


当用户看到这些按钮时,它们将会显示在

savings.aspx?category =无论什么页面,当他们点击另一个按钮

查看其他类别时,我在这些按钮周围的所有链接都指向

各种类别。


然而,当我按下这些按钮时,没有任何反应。


我忘了在这里做点什么吗?

感谢您的帮助

解决方案

我也尝试删除< a href> ImageButtons周围的标签和创建

点击按钮的事件

Response.Redirect(" savings.aspx?category = whatever");

并在我的点击代码中为这些陈述设置了一个断点,他们没有
事件被执行。


我必须是一个非常小的东西在这里:P


再次感谢


" tperri"写道:

我有一个HTML表格,其中包含以下几个字段:

< A href =" Savings.aspx?category = Food"> < asp:imagebutton id =" imgFood"
ImageUrl =" images\buttons\btn-food-i.gif" runat =" server">< / asp:imagebutton>< / A>

当用户看到这些按钮时,它们目前会在
savings.aspx?类别上=无论什么页面,当他们点击另一个按钮来查看其他类别时,我在这些按钮周围的所有链接都指向他们的各种类别。

然而,当我按下这些按钮,没有任何反应。

我忘了在这里做点什么吗?

感谢您的帮助



这很可能是因为ImageButton被渲染为< input>元素
HTML中的



为什么要将ImageButton包装在锚点中?假设你想要做什么工作,当回发发生时,超链接如何设置

,因为过去已经导航了。毕竟,浏览器

无法同时导航到两个页面。

" tperri" < TP **** @ discussions.microsoft.com>在消息中写道

news:93 ********************************** @ microsof t.com ...

我也尝试删除< a href>使用
Response.Redirect(" savings.aspx?category = whatever?);
创建按钮的Click事件和
创建Click事件,并在我的Click中为这些语句添加断点代码和他们
没有事件被执行。

我必须在这里做一些非常小的事情:P

再次感谢
tperri写道:

我有一个HTML表格,其中包含以下几个字段:

< A href =" Savings.aspx?category = Food"> < asp:imagebutton id =" imgFood"
ImageUrl =" images\buttons\btn-food-i.gif"
runat =" server">< / asp:imagebutton>< / A>
当用户看到这些按钮时,它们目前会在
savings.aspx?类别上=什么页面,当他们点击另一个按钮
来查看其他类别时,我在这些按钮周围的所有链接
直接指向他们的各种类别。

然而,当我按下这些按钮,没有任何反应。

我忘了在这里做点什么吗?

感谢您的帮助


是。这是做你想做的正确方法。


如果你的按钮没有收到活动,请确保你看到这样的东西

inGenerated由表单设计师部分代码:


imgFood.Click + = new ImageClickEventHandler(imgFoodClick);


表单设计者应该将此添加到您的代码中,但是某些时候

不明原因他们被删除了,所以你应该先检查一下。


" tperri" < TP **** @ discussions.microsoft.com> ???????¥l·s?D:93 ********************************* * @ microsoft.com ...

我也尝试删除< a href> ImageButtons周围的标签和
使用
Response.Redirect(savings.aspx?category = whatever);
点击按钮的事件,并在这些上放置一个断点在我的点击代码中的陈述,他们没有
事件被执行。

我必须在这里做一些非常小的事情:P

谢谢再次

tperri写道:

我有一个HTML表格,其中包含以下几个字段:

< A href =" Savings.aspx?category = Food"> < asp:imagebutton id =" imgFood"
ImageUrl =" images\buttons\btn-food-i.gif"
runat =" server">< / asp: imagebutton>< / A>

当用户看到这些按钮时,它们将出现在
savings.aspx?类别=任何页面,当他们点击另一个按钮时

看看其他类别,我在这些按钮周围的所有链接
直接指向各种类别。

然而,当我按下这些按钮时,什么也没有发生了。

我忘了在这里做点什么吗?

感谢您的帮助



I have an HTML table with several fields like this:

<A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
ImageUrl="images\buttons\btn-food-i.gif" runat="server"></asp:imagebutton></A>

When the user sees these buttons, they will currently be on the
savings.aspx?category=whatever page, and when they click another button to
look at other categories, all the links I have around these buttons direct to
their various categories.

However, when I press these buttons, nothing happens.

Did I forget to do something here?

thanks for the help

解决方案

I also tried removing the <a href> tags around the ImageButtons and creating
Click events for the buttons with
Response.Redirect("savings.aspx?category=whatever" );
and placed a breakpoint on these statements in my Click code and they don''t
event get executed.

I must be missiong something really small here :P

Thanks again

"tperri" wrote:

I have an HTML table with several fields like this:

<A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
ImageUrl="images\buttons\btn-food-i.gif" runat="server"></asp:imagebutton></A>

When the user sees these buttons, they will currently be on the
savings.aspx?category=whatever page, and when they click another button to
look at other categories, all the links I have around these buttons direct to
their various categories.

However, when I press these buttons, nothing happens.

Did I forget to do something here?

thanks for the help



That is probable because the ImageButton is rendered as an <input> element
in the HTML.

Why do you want to wrap an ImageButton in an anchor? Suppose what you
wanted to do works, when the postback happens, how is the hyperlink suppose
to react since the past has already navigated. After all, the browser
cannot navigate to two pages at the same time.
"tperri" <tp****@discussions.microsoft.com> wrote in message
news:93**********************************@microsof t.com...

I also tried removing the <a href> tags around the ImageButtons and creating Click events for the buttons with
Response.Redirect("savings.aspx?category=whatever" );
and placed a breakpoint on these statements in my Click code and they don''t event get executed.

I must be missiong something really small here :P

Thanks again

"tperri" wrote:

I have an HTML table with several fields like this:

<A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
ImageUrl="images\buttons\btn-food-i.gif" runat="server"></asp:imagebutton></A>
When the user sees these buttons, they will currently be on the
savings.aspx?category=whatever page, and when they click another button to look at other categories, all the links I have around these buttons direct to their various categories.

However, when I press these buttons, nothing happens.

Did I forget to do something here?

thanks for the help



Yes. This is the right way to do what you want.

If your button do not receive event, make sure you see something like this
in "Generated by form designer" part of code:

imgFood.Click += new ImageClickEventHandler(imgFoodClick);

The form designer should have added this to your code, but sometime for
unknown reason they''re removed, so you should check it first.

"tperri" <tp****@discussions.microsoft.com> ???g?ó?l¥ó·s?D:93********************************* *@microsoft.com...

I also tried removing the <a href> tags around the ImageButtons and
creating
Click events for the buttons with
Response.Redirect("savings.aspx?category=whatever" );
and placed a breakpoint on these statements in my Click code and they
don''t
event get executed.

I must be missiong something really small here :P

Thanks again

"tperri" wrote:

I have an HTML table with several fields like this:

<A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
ImageUrl="images\buttons\btn-food-i.gif"
runat="server"></asp:imagebutton></A>

When the user sees these buttons, they will currently be on the
savings.aspx?category=whatever page, and when they click another button
to
look at other categories, all the links I have around these buttons
direct to
their various categories.

However, when I press these buttons, nothing happens.

Did I forget to do something here?

thanks for the help



这篇关于&lt; a href&gt;围绕&lt; asp:imagebutton&gt;不工作 - 需要一些帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆