Is there a way I can launch a Server Side function from JavaScript?
On a Button Click, I am using JavaScript to print to current page. When the print has been sent, I want to run a Server Side Function to update a record (which also changes the screen so I have to wait until it prints to run the server side function).
Thanks.I imagine in your JS function, you could print and then do a postback to the server?
This may get your problem resolved.
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Button1.Attributes.Add("onClick","javascript:DoSomething();");
string html = "";
html += "<script>";
html += " function DoSomething()";
html += " {";
html += " window.print();";
html += " }";
html += "</script>";
Response.Write(html);
}
private void Button1_Click(object sender, System.EventArgs e)
{
Update();
}
public void Update()
{
Response.Write("Now going to update the record.");
}
How to force a postback using javascript:
http://weblogs.asp.net/mnolton/archive/2003/06/04/8260.aspx
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment