><script language="javascript" type="text/javascript" > function SetValue() > { > var myControl = document.getElementById('txtHidden'); > if (myControl) > document.forms[0].submit(); > // Instead of this you can use ASP.NET's __doPostback code to fire the postback. If you use it, it's then possible to intercept this info in the page > // __doPostBack('ControlOrEventCausingPostback', 'AnyParameters'); > // In that case, you don't need the hidden input - pass the parameter as the second parameter of __doPostBack > } ></script ><input type="hidden" name="txtHidden" / > >// In your ASP.NET code-behind: >if (Page.IsPostBack) >{ > string hiddenValue = Request.Form["txtHidden"]; > // Do something > // Or if you are using ASP.NET's __doPostBack you can do this in Page_Load: > // string eventName = Request.Form["__EVENTTARGET"]; > // string arg = Request.Form["__EVENTARGUMENT"]; > // if (eventName == "ControlOrEventCausingPostback") > // this.DoSomething(arg); >} > >>
>string script = "<script type=\"text/javascript\">JSFunctionToRun();</script>"; >Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "JustNameOfScript", script); >// You can actually call RegisterClientScriptBlock with a 4th parameter of true - that will add the <script tag stuff for you. >>