Cause a Postback in .NET

/ Published in: C#
Save to your folder(s)

This code will execute a postback.

Copy this code and paste it in your HTML
  1. private void FirePostBack()
  2. {
  3. StringBuilder sbScript = new StringBuilder();
  4. sbScript.Append("<script language='JavaScript' type='text/javascript'>\n");
  5. sbScript.Append("<!--\n");
  6. sbScript.Append(ClientScript.GetPostBackEventReference(this, "PBArg") + ";\n");
  7. sbScript.Append("// -->\n");
  8. sbScript.Append("</script>\n");
  9. ClientScript.RegisterStartupScript(GetType(), "AutoPostBackScript", sbScript.ToString());
  10. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.