0

I know there already exist a thread for the same question but it didn't help me fix it (I tried what they suggested) anyways here is the html side of the button, is there anything I'm missing:

<asp:Button ID="btnadd" runat="server" Text="add" OnClick="btnadd_Click" CausesValidation="False"/>

And this is the c# side:

protected void btnadd_Click(object sender, EventArgs e)
{
    //do something
}

EDIT: solution, i had the button inside a form causing it not to work, removed the form and it worked

6
  • I would guess the button is not posting back to server. Try adding AutoPostBack="True" to access server side methods. Commented Jan 29, 2020 at 11:35
  • Ryan Thomas where do i need to add it? Commented Jan 29, 2020 at 11:40
  • In your button declaration, it's an attribute, so just after CausesValidation should be fine. Commented Jan 29, 2020 at 11:41
  • did not work... Commented Jan 29, 2020 at 11:49
  • stackoverflow.com/questions/15569857/… Commented Jan 29, 2020 at 12:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.