Call C# Method using Javascript from ASP.Net with Parameters -
Call C# Method using Javascript from ASP.Net with Parameters -
can help me phone call c# method in code behind using javascript in aspx page parameters?
here javascript have calls sample() method:
<script type="text/javascript"> function showmodal(arr, hey) { '<%=sample(arr,hey)%>'; } </script> i have c# code called has 2 parameters:
protected string sample(int i, string a) { lblsample.text =i + "," + a; homecoming lblsample.text; } this gave me error on javascript code:
arr not exist in current context
by way, javascript executed when particular bar in chart clicked. utilize fusioncharts.
here's code on how phone call , pass parameters showmodal javascript function:
xmlstring.appendformat("<set label='{3}' value='{1}' tooltext='employee: {0}{2}hours:{1}' link='j-showmodal-{1}, {1}'/>", dt.rows[i][1].tostring(), dt.rows[i][2].tostring(), "{br}", dt.rows[i]["empnamedot"].tostring());
expanding on david's answer: there many ways access server-side client-side after page rendered. partial list , in no particular order:
webmethod updatepanel asmx web service wcf web service web api signalr the 1 take depends on trying achieve. in case, need create ajax request (this can done using jquery) , handle returned value in javascript code. seems using webforms. updatepanel webforms-ish way of doing this. updatepanel takes care of ajax calls you, need set correctly.
edit: if edit question improve explanation of trying achieve, maybe can provide more operative answer.
c# javascript asp.net
Comments
Post a Comment