Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 30-Nov-10 23:31pm
v3
Comments
Dalek Dave 1-Dec-10 5:31am    
Edited for Grammar and Readability.

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.
 
Share this answer
 
Comments
Dalek Dave 1-Dec-10 5:31am    
Good Call.
pawanvats 1-Dec-10 8:10am    
thank you madhukk.it's working .thanks for ur kind help.
Thank you for your question. Follow the bellow code.
XML
<asp:Button ID="Button1" runat="server" Text="btnFirstButton" OnClientClick="return false" />
<asp:Button ID="Button2" runat="server" Text="btnSecondButton" />

Thanks,
Mamun
 
Share this answer
 
v2
Comments
Dalek Dave 1-Dec-10 5:32am    
Good Answer.
Abdul Quader Mamun 1-Dec-10 5:33am    
Thanks
pawanvats 1-Dec-10 7:12am    
thnx for ur suggestion but i am using master pages and link button is on content page
Abdul Quader Mamun 1-Dec-10 10:15am    
When asking question describe everything clearly.
hi,
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" />
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900