﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Call RegisterClientScriptBlock during Fly PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Call-RegisterClientScriptBlock-during-Fly-PostBack/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Call RegisterClientScriptBlock during Fly PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Call-RegisterClientScriptBlock-during-Fly-PostBack/</link><pubDate>Tue, 14 Dec 2010 03:08:04 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;Please follow the step-by-step below carefully in order to add a script block to the rendered page.&lt;/span&gt;&lt;/p&gt;
&lt;ol style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;&lt;li&gt;Add a JScript file into the project.&lt;br /&gt;This JScript file is the file that contains the script block that about to be added to the rendered page.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;MyScript.js&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;function&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;ShowKeyCode() {
    var textBox = document.getElementById(&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: #a31515; font-size: 9pt"&gt;"Message"&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;);

    alert(event.keyCode);&lt;/span&gt;
    
    &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;return true;&lt;/span&gt;
&lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;ol style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt" start="2"&gt;&lt;li&gt;Use InvokeScript() method in OnInitializePostBack server-side event of WebGrid.&lt;br /&gt;In the InvokeScript() method, call IS.AddScript and pass the path of the JScript file in the step #1.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;Default.aspx.cs&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;protected void WebGrid1_InitializePostBack(object sender, ISNet.WebUI.WebGrid.PostbackEventArgs e)
{
    WebGrid1.ClientAction.InvokeScript(&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: #a31515; font-size: 9pt"&gt;"IS.AddScript('MyScript.js');"&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;);
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;If the InvokeScript doesn’t suit with your scenario, please kindly let us know.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;Edited
&lt;em&gt;reason: add and correct step-by-step information.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Call RegisterClientScriptBlock during Fly PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Call-RegisterClientScriptBlock-during-Fly-PostBack/</link><pubDate>Sun, 12 Dec 2010 22:45:36 GMT</pubDate><dc:creator>Sir_Xblack</dc:creator><description>&lt;p&gt;Hi All,&lt;/p&gt;
&lt;p&gt;I have a referenced dll which raise javascript alert message by calling page.ClientScript.RegisterClientScriptBlock(typeof(Alert), "alert", script);&lt;/p&gt;
&lt;p&gt;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)?&lt;/p&gt;
&lt;p&gt;Thanks and Regards,&lt;/p&gt;
&lt;p&gt;Huy.&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>