ASP.NET pages can only contain one server-side Form tag where all server-side controls must be defined. This only becomes a problem when a page requires several form sections. For example, a page might include two form sections; search and log in. If these both have their own submit buttons and are defined in the same server-side Form tag, how does the page know which event should be triggered when the user presses the Enter key? Normally the first button on the page takes precedence or nothing happens at all.
To assign default buttons to each form section, simply place them (and any other related controls) inside a PlaceHolder control and set the DefaultButton attribute to the respective button ID.
<asp:Panel DefaultButton="btnSubmit" runat="server">
<asp:TextBox ID="tbName" runat="server" />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
</asp:Panel>
This rule is not applicable to the LinkButton control (unless in IE).
1 comment:
Genial fill someone in on and this enter helped me alot in my college assignement. Say thank you you as your information.
Post a Comment