Default button in with master page

One of the most important thing in developing web pages is handling the "Enter key" for form submission or making the button which we provide Button to click on as default button, there are many easiest ways but sometime its becomes a little tricky using master page with button in panel.
ASP.NET introduces "defaultbutton" property to the ID of the Button, whose event we want to fire, our job is done. By using this property we can make our button as default button.
In page load we need to just write the below code:

 protected void Page_Load(object sender, EventArgs e)

         this.Page.Form.DefaultButton = yourbuttonid.UniqueID;

Post a Comment

Previous Post Next Post