S
Steve Hershoff
Hi everyone,
We have a javascript function we'd like to call from within a C# method in
our code-behind file. The way it has worked historically is we'd call the
method from a hyperlink, like this:
<a href='javascript:MyMethod(Param1, Param2)' runat="server"
ID="MyLink">click here</a>
....what I'd like to do now is somehow call "MyMethod" from the code-behind
file. I've tried something like this but it doesn't do anything, as best I
can tell.
void JavaScriptTest()
{
Response.Write("<script language='javascript'>");
Response.Write("MyMethod(Param1, Param2);");
Response.Write("<"+"/script>");
}
If I replace the MyMethod line above with something like a vanilla
window.alert(), it does work, so I figure I must be close to an answer?
We have a javascript function we'd like to call from within a C# method in
our code-behind file. The way it has worked historically is we'd call the
method from a hyperlink, like this:
<a href='javascript:MyMethod(Param1, Param2)' runat="server"
ID="MyLink">click here</a>
....what I'd like to do now is somehow call "MyMethod" from the code-behind
file. I've tried something like this but it doesn't do anything, as best I
can tell.
void JavaScriptTest()
{
Response.Write("<script language='javascript'>");
Response.Write("MyMethod(Param1, Param2);");
Response.Write("<"+"/script>");
}
If I replace the MyMethod line above with something like a vanilla
window.alert(), it does work, so I figure I must be close to an answer?