I\'m working on asp.net (C#) project which include some page files (aspx, aspx.cs) and some only (.cs) file. I\'m able to access JavaScript/jQuery functions from page files
you can try to write to a response stream directly and output
Response.Write("<script type=\"text/javascript\"> your JS call</script>");
Regards, Szymon
You can call a JavaScript function using registerStartupScript
.
ASPX Page
<script type="text/javascript">
function printOutput(arg) {
alert(arg);
}
</script>
Code Behind
protected void DoSomethingButton_Click(object sender, EventArgs e)
{
ClientScriptManager cs = Page.ClientScript;
cs.RegisterStartupScript(typeof (Page), "PrintScript_" + UniqueID, "printOutput('My HTML Code Generated by jquery function');", true);
}
You need to pass into the web.cs a reference to the page. You will then have access to the page.clientscript method