<asp:TextBox runat="server" ID="textbox2" MaxLength="2" onfocus="textbox2_focus" />
and I have c# codebehind method:
public void textbox2_focus(object sender, EventArgs e)
{
var x = 5;
}
But This code tries to execute JavaScript Function. How to execute c# function from code behind? I tried something like:
<asp:TextBox runat="server" ID="textbox2" MaxLength="2" onfocus="<%=textbox2_focus() %>"/>
but didn't work.