tperri写道: 是。这是做你想做的正确方法。 如果你的按钮没有收到活动,请确保你看到这样的东西 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 thesavings.aspx?category=whatever page, and when they click another button tolook at other categories, all the links I have around these buttons direct totheir 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 creatingClick events for the buttons withResponse.Redirect("savings.aspx?category=whatever" );and placed a breakpoint on these statements in my Click code and they don''tevent 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> elementin the HTML. Why do you want to wrap an ImageButton in an anchor? Suppose what youwanted to do works, when the postback happens, how is the hyperlink supposeto react since the past has already navigated. After all, the browsercannot navigate to two pages at the same time."tperri" <tp****@discussions.microsoft.com> wrote in messagenews:93**********************************@microsof t.com... I also tried removing the <a href> tags around the ImageButtons andcreating Click events for the buttons with Response.Redirect("savings.aspx?category=whatever" ); and placed a breakpoint on these statements in my Click code and theydon''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 buttonto look at other categories, all the links I have around these buttonsdirect 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 thisin "Generated by form designer" part of code: imgFood.Click += new ImageClickEventHandler(imgFoodClick); The form designer should have added this to your code, but sometime forunknown 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 andcreating 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 这篇关于< a href>围绕< asp:imagebutton>不工作 - 需要一些帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-16 23:47