i tried pass parameter from jscript to code behind, but it don't work. My code:
[C#]
[WebMethod]
public static String sendEmail(String str)
{
...
msg.body = str;
...
return str;
}
[jscript]
If i use function alert, it return null
function onOkClickButton()
{
var content = "Hello";
alert("<%=sendEmail(" + content + ")%>");
}
if i use PageMethod, my email's body is null
<asp:ScriptManager enablePageMethods="true"></asp:ScriptManager>
function onOkClickButton()
{
var content = "Hello";
PageMethods.sendEmail(content, onSuccess, onError);
}
function onSuccess(text)
{
alert(text)
}
function onError(text)
{
alert(text)
}
Can you help me?