I have an .aspx page that contains two buttons one is “btnCancel” and another one is “btnSave”.
<asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="Button" OnClick="btnCancel_Click" />
<asp:Button ID="btnSave" runat="server" Text="Save" CssClass="Button" OnClick="btnSave_Click"
OnClientClick="tinyMCE.triggerSave(false,true);" ValidationGroup="grp"/>
Now the problem is after filling up some of the textboxes which are present in that page, if I press the “Enter button” the “btnCancel_Click” event is firing instead of “btnSave_Click”.
Can any one please suggest me how to set the “btnSave_Click” button as the default one. So that if any one press the “enter button” it will fire the “btnSave_Click” event.
Any help please.
Updated Question:
<asp:Panel DefaultButton="btnSave" runat="server" ID="pnlTest">
<asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="Button" OnClick="btnCancel_Click" />
<asp:Button ID="btnSave" runat="server" Text="Save" CssClass="Button" OnClick="btnSave_Click"
OnClientClick="tinyMCE.triggerSave(false,true);" ValidationGroup="grp" />
</asp:Panel>
put your form controls inside asp.net Panel and set
DefaultButtonto your button idExample: