在C Sharp ASP.NET中IE中的按钮焦点问题 [英] Button Focus issue in ie in c sharp asp .net
问题描述
请参见以下代码.
Hi,
please see the following code.
<body>
<form id="form1" runat="server">
<asp:Panel ID="Panel1" runat="server" Width="100" Height="300" BorderColor="Black"
BorderWidth="1">
<asp:Button ID="Button1" runat="server" Text="Back" />
</asp:Panel>
<br>
<asp:Panel ID="Panel2" runat="server" Width="100" Height="300" BorderColor="Black"
BorderWidth="1">
<asp:Button ID="Button2" runat="server" Text="submit" />
</asp:Panel>
</form>
</body>
</html>
在第二个面板内单击时,焦点将移至IE中的后退按钮".请调查一下.
While clicking inside the second panel, the focus is coming to the ''Back Button'' in IE. Please look into it.
推荐答案
在后退按钮中使用
UseSubmitBehavior="false"
.
这样写
in back button.
write like this
<form id="form1" runat="server">
<asp:Panel ID="Panel1" runat="server" Width="100" Height="300" BorderColor="Black" BorderWidth="1">
<asp:Button ID="Button1" runat="server" Text="Back" UseSubmitBehavior="false"/>
</asp:Panel>
<br />
<asp:Panel ID="Panel2" runat="server" Width="100" Height="300" BorderColor="Black" BorderWidth="1">
<asp:Button ID="Button2" runat="server" Text="submit" UseSubmitBehavior="false" />
</asp:Panel>
<br />
</form>
未关闭新的行标签和面板标签,并导致格式问题.
new line tag and panel tag wasn''t closed and causing formatting issue.
我想您完全误解了Focus
的行为.它绝不与在控件的容器内单击有关.为此,您将必须编写一个自定义事件,并且在其背后的代码中,最后必须将该行包括为
I guess you have completely misunderstood theFocus
''s behavior. Its in no way related to clicking inside the container of your control. For that, you will have to write a custom-event and in the code-behind you will have to finally include the line as
Button2.Focus();
这就是Focus
的目标.
如果仍然有任何疑问,请确认是否需要单击面板上的按钮并集中精力于按钮,还是只是在玩耍以感受Focus
的行为?
HTH
问候
拉杰夫
如果有帮助,请对答案进行投票并标记为接受
This is what for which Focus
is destined.
If you still have any concerns,can you please confirm if clicking on the panel and getting focus on the button was your requirement or were you just playing to have a feel of the Focus
''s behavior?
HTH
Regards
Rajeev
Please vote and mark answer as accepted if this helps you
这篇关于在C Sharp ASP.NET中IE中的按钮焦点问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!