禁用页面回发
问题描述:
你好朋友,
我有关于回发的问题.
我有2个链接按钮.如果按回车键,则第一个链接按钮将发布回服务器,但我想将第二个发布回,而不是第一个.
如何在按Enter键时设置这样的优先级?
在此先感谢.
Hello friends,
I have a problem regarding post-back.
I have 2 link buttons. If I press enter then first link button is posting back to server, but I want to make the second one post back rather than the first.
How can I set priorities like this on pressing enter key?
Thanks in Advance.
答
可以将名为defaultbutton
的属性设置为默认按钮.在面板或表单中将dafault按钮设置为2个链接按钮.
A property named defaultbutton
is available to set as the default button. set your dafault button as 2 link button in panel or in form.
谢谢您的提问.请遵循以下代码.
Thank you for your question. Follow the bellow code.
<asp:Button ID="Button1" runat="server" Text="btnFirstButton" OnClientClick="return false" />
<asp:Button ID="Button2" runat="server" Text="btnSecondButton" />
谢谢,
马蒙
Thanks,
Mamun
只需在uraspx页面中放置一个asp面板即可.并将默认按钮名称设为您的第二个bitton id. 希望对您有帮助..
just place an asp panel inside uraspx page..and make that the default button name as ur second bitton id..here am giving you one example..
Hope this may help you..
<asp:panel id="Panel1" runat="server" defaultbutton="btn2" xmlns:asp="#unknown">
<asp:button id="btn1" runat="&"server"/">
<asp:button id="btn2" runat="server" />