JS calls the foreground embedded C # method:
The C # method for page embedding is as follows:
<%@ Import namespace= "System"%>
<%@ Import namespace= "System.IO"%>
<%@ Import namespace= "System.Runtime.InteropServices"%>
<script language= "C #" runat= "Server" >
public string Testjstofunction (string strtest)
{
return strtest;
}
public string testjstofunction ()
{
Return "JS call page C # method";
}
public string Testjstofunction (string strtest, String ss)
{
return strtest;
}
</script>
There is a method without parameters, including a method containing two parameters.
JS can write this:
2014-2-20 add test get variable value in SL page code
function Getusernamepwd (userName, PWD) {
Alert (userName + "\ n" + Pwd);
var name = UserName + ', ' + Pwd;
var pwd = pwd;
var stt= ' <%=testjstofunction ("' + name+ ', ' +pwd + '")%> ';
alert (STT);
Return "returns the verification result:";
}
var stt= ' <%=testjstofunction ("' + name+ ', ' +pwd + '")%> in the above statement; Call the C # method that contains a parameter.
At present, we have not found the two parameters can be called JS writing.
There's a problem, Q I'm 1419226548 or 981243247