I have an asp button, and I want to send parameter to codebehind when it's click. so I do like this tutorial: http://www.devchix.com/2007/08/10/aspnet-passing-parameters-in-button-click-handler/
I have button:
<asp:Button ID="button1" runat="server" CommandArgument="MyVal1"
CommandName="ThisBtnClick" OnClick="MyBtnHandler" />
and event :
void MyBtnHandler(Object sender, EventArgs e)
{
Button btn = (Button)sender;
switch (btn.CommandName)
{
case "ThisBtnClick":
//lala
break;
}
but when I run , there is a ' Compilation Error'.
Compiler Error Message: CS1061: 'ASP.softwares_aspx' does not contain a definition for 'MyBtnHandler' and no extension method 'MyBtnHandler' accepting a first argument of type 'ASP.softwares_aspx' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 110: Line 111: Line 112:
Line 114:
why?
thanks!!
publicorprotectedfor it to be used as part of theOnClickhandler. Functions, as standard, areprivateif they are not specifically stated