Apr 13, 2011

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

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CodeBehindMethodFromJavascript.aspx.cs"Inherits="CodeBehindMethodFromJavascript" %><!
<
<
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">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>

1 comment:

Unknown said...

Nice information thanks for sharing
SBI Clerk Cut off 2016
SBI Clerk Cut off 2016 check expected State wise Cut off marks Section wise category wise cutoff can download from the official website

Regards

Regards