Parameters through onclick event in asp

asp.net, onclick, parameter-passing

Solution

Try this :

protected void btnUpdateFacturaID_Click(Object sender, EventArgs e)
{
     Button btn = (Button)sender;
     //do whatever with 
     //btn.CommandArgument.ToString()
}

Problem

I've been trying to pass parameters through the onclick event using asp as follows: ``` <asp:Button runat="server" ID="btnUpdateFacturaID" style="display:none;" onclick="btnUpdateFacturaID_Click" CommandArgument="test" /> ``` And on the other side: ``` protected void btnUpdateFacturaID_Click(object sender, CommandEventArgs e) { string s = e.CommandArgument.ToString(); } ``` But I receive an error of no overload for 'btnUpdateFacturaID_Click' mathes delegate 'System.EventHandler' In fact, I had initially the functions as follows: ``` protected void btnUpdateFacturaID_Click(object sender, EventArgs e) { string s = e.CommandArgument.ToString(); } ``` But this way I can't (or I don't actually know, which is much more probable) pass parameters through the event. What amb I missing?

Original source