Problems with asp:Button OnClick event...

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2009-06-17T07:05:16Z Indexed on 2010/05/09 10:18 UTC
Read the original article Hit count: 323

Filed under:
|
|

Hi,

Here is my button

<asp:Button ID="myButton" Text="Click Me" OnClick="doSomething(10)" runat="server" />

Here is the server function

public void doSomething(int num)
{
    int someOtherNum = 10 + num;
}

When I try to compile the code I get the error "Method Name Expected" for the line:

<asp:Button ID="myButton" Text="Click Me" OnClick="doSomething(10)" runat="server" />

What am I doing wrong? Am I not allowed to pass values to the server from an OnClick event?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about onclick