ASP.NET JavaScript to C# Execute
Posted on Monday, July 30, 2012
|
No Comments
Java script to C# parameter pass and run function
In ASPX FILE
<script type="text/javascript">
var myResult = 'PurchaseID';
__doPostBack('PaidHandler',myResult);
</script>IN C#
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
string target = Request.Form["__EVENTTARGET"];
string value = Request.Form["__EVENTARGUMENT"];
if (!string.IsNullOrEmpty(target) && target.Equals("PaidHandler"))
{
HiddenFieldTempPayID.Value = value;
}
}
}
Here doPostBack take two parameter first is target and second is if you want to pass value