Wednesday, April 13, 2011

How to call Codebehind method from Javascript (C# ASP.NET)

<
<
html xmlns="http://www.w3.org/1999/xhtml">head runat="server"><title></title><script type="text/javascript">

alert(
}

</
<
function test() {var VarA = document.getElementById("txtAB").value;'<%=new CodeBehindMethodFromJavascript().GetName("' + VarA + '")%>');</script>head>body><form id="form1" runat="server"><div><input type="text" id="txtAB" /><input type="button" value="ClickMe" onclick="test()" /></div>
</
</
</form>body>html>