I have problem in asp.net button control.
I define a button in form, onclick
event of button is not firing when I click on the button.
<asp:Button ID="btn_QuaSave" runat="server" Text="SAVE" OnClick="btn_QuaSave_Click" /> protected void btn_QuaSave_Click(object sender, EventArgs e) { }
From the controls toolbar drag a button over to the page. If you double click the button in design view it will automatically create the event handler in code behind. The button control has a couple of properties OnClick and OnClientClick. Use OnClientClick to trigger any JavaScript on the page.
The Click event is raised when the Button control is clicked. This event is commonly used when no command name is associated with the Button control (for instance, with a Submit button). For more information about handling events, see Handling and Raising Events.
Because your button is in control
it could be that there is a validation from another control that don't allow the button to submit. The result in my case was to add CausesValidation
property to the button:
<asp:Button ID="btn_QuaSave" runat="server" Text="SAVE" OnClick="btn_QuaSave_Click" CausesValidation="False"/>
Have you copied this method from other page/application ? if yes then it will not work, So you need to delete the event and event name assigned to the button then go to design and go to button even properties go to onClick event double click next to it, it will generate event and it automatically assigns event name to the button. this should work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With