But in ASP.NET when user press enter key the page gets post back but the button event doesn't get fired hence whatever code u've written in the click event doesn't get executed and it just like refreshing the page , to handle this situation in ASP.NET 2.0 ,we need to set the Defaultbutton property which indicates which button events should get fired when user press enter key to submit the form.
<form id="form1" runat="server" defaultbutton="Button1">
<div>
<asp:TextBox ID="TextBox1" runat="server"/>
<asp:TextBox ID="txtTest" runat="server"/>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit"/>
</div>
</form>
or if we use panel than
<asp:Panel ID="Panel1" runat="server" defaultbutton="Button1">
When I try to enclose my page in asp:panel tags, my aspx.vb page can't find the controls (lblSomething.text = "abc") doesn't work anymore
ReplyDeletehttp://twitter.com/dotnetfreak
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete