Login
Latest Development Blogs
Forum Topics Post
Browse By Tag
Hi All,
I have a referenced dll which raise javascript alert message by calling page.ClientScript.RegisterClientScriptBlock(typeof(Alert), "alert", script);
But it didn't work when Webgrid do fly postback process. So How can I call RegisterClientScriptBlock when Webgrid do Fly postback (not full post back)?
Thanks and Regards,
Huy.
If you are intending to add a script block to the rendered page when WebGrid do FlyPostBack, please try to use InvokeScript method of WebGrid in OnInitializePostBack server-side event of WebGrid.
Please follow the step-by-step below carefully in order to add a script block to the rendered page.
MyScript.js
function ShowKeyCode() { var textBox = document.getElementById("Message"); alert(event.keyCode); return true; }
Default.aspx.cs
protected void WebGrid1_InitializePostBack(object sender, ISNet.WebUI.WebGrid.PostbackEventArgs e) { WebGrid1.ClientAction.InvokeScript("IS.AddScript('MyScript.js');"); }
If the InvokeScript doesn’t suit with your scenario, please kindly let us know.
Edited reason: add and correct step-by-step information.