﻿<?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 - Disable/Lock grid during refresh?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DisableLock-grid-during-refresh/</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>Disable/Lock grid during refresh?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DisableLock-grid-during-refresh/</link><pubDate>Fri, 28 May 2010 13:17:31 GMT</pubDate><dc:creator>yudi</dc:creator><category>WebGrid</category><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;I assume that the goal is to avoid user from spamming changes on WebGrid during ‘Refresh’. Well, please allow me to offer you a trick for this scenario. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;The idea is very simple. I have a div tag that has same dimension (width and height) with WebGrid. During WebGrid refresh, I simply set the z-index style of the div to a value that higher than the value of z-index of WebGrid. Practically, the div will be on top of WebGrid during refresh and will bring back WebGrid on top after WebGrid finish refresh. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;We can utilize OnBeforeRequest and OnAfterResponseProcess client side event to set the z-index. Below is the snippet code of the page and the script. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;&lt;span style="text-decoration: underline"&gt;Page code&lt;/span&gt;:&lt;/span&gt;&lt;/p&gt;&lt;pre style="font-family: 'courier new'; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;div&lt;/span&gt; &lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;="div1"&lt;/span&gt; &lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;="&lt;/span&gt;&lt;span style="color: red"&gt;height&lt;/span&gt;: &lt;span style="color: blue"&gt;250px&lt;/span&gt;; &lt;span style="color: red"&gt;width&lt;/span&gt;: &lt;span style="color: blue"&gt;500px&lt;/span&gt;; &lt;span style="color: red"&gt;position&lt;/span&gt;: &lt;span style="color: blue"&gt;absolute&lt;/span&gt;;
    &lt;span style="color: red"&gt;background-color&lt;/span&gt;: &lt;span style="color: blue"&gt;#E5EECC&lt;/span&gt;; &lt;span style="color: red"&gt;filter&lt;/span&gt;: &lt;span style="color: blue"&gt;alpha(opacity=50)&lt;/span&gt;; &lt;span style="color: red"&gt;-moz-opacity&lt;/span&gt;: &lt;span style="color: blue"&gt;0.5&lt;/span&gt;; &lt;span style="color: red"&gt;opacity&lt;/span&gt;: &lt;span style="color: blue"&gt;0.5"&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ISWebGrid&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;WebGrid&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;="WebGrid1"&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;="server"&lt;/span&gt; &lt;span style="color: red"&gt;DataSourceID&lt;/span&gt;&lt;span style="color: blue"&gt;="AccessDataSource1"&lt;/span&gt;
    &lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;="250px"&lt;/span&gt; &lt;span style="color: red"&gt;UseDefaultStyle&lt;/span&gt;&lt;span style="color: blue"&gt;="True"&lt;/span&gt; &lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;="500px"&amp;gt;&lt;/span&gt;
    &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;LayoutSettings&lt;/span&gt; &lt;span style="color: red"&gt;AllowAddNew&lt;/span&gt;&lt;span style="color: blue"&gt;="Yes"&lt;/span&gt; &lt;span style="color: red"&gt;AllowDelete&lt;/span&gt;&lt;span style="color: blue"&gt;="Yes"&lt;/span&gt; &lt;span style="color: red"&gt;AllowEdit&lt;/span&gt;&lt;span style="color: blue"&gt;="Yes"&amp;gt;&lt;/span&gt;
        &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ClientSideEvents&lt;/span&gt; &lt;span style="color: red"&gt;OnBeforeRequest&lt;/span&gt;&lt;span style="color: blue"&gt;="WebGrid1_OnBeforeRequest"&lt;/span&gt;
            &lt;span style="color: red"&gt;OnAfterResponseProcess&lt;/span&gt;&lt;span style="color: blue"&gt;="WebGrid1_OnAfterResponseProcess" /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;LayoutSettings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;
    &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RootTable&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;
    ...
    &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;RootTable&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ISWebGrid:WebGrid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;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;&lt;span style="text-decoration: underline"&gt;Script code&lt;/span&gt;:&lt;/span&gt;&lt;/p&gt;&lt;pre style="font-family: 'courier new'; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;script&lt;/span&gt; &lt;span style="color: red"&gt;language&lt;/span&gt;&lt;span style="color: blue"&gt;="javascript"&lt;/span&gt; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;="text/javascript"&amp;gt;&lt;/span&gt;
    &amp;lt;!--
    &lt;span style="color: blue"&gt;function&lt;/span&gt; WebGrid1_OnBeforeRequest(controlId, action) {
        &lt;span style="color: blue"&gt;var&lt;/span&gt; WebGrid1 = ISGetObject(controlId);
        &lt;span style="color: blue"&gt;var&lt;/span&gt; div1 = document.getElementById(&lt;span style="color: #a31515"&gt;"div1"&lt;/span&gt;);

        &lt;span style="color: blue"&gt;if&lt;/span&gt; (action == &lt;span style="color: #a31515"&gt;"Refresh"&lt;/span&gt;)
            div1.style.zIndex = 1;

        &lt;span style="color: blue"&gt;return true&lt;/span&gt;;
    }

    &lt;span style="color: blue"&gt;function&lt;/span&gt; WebGrid1_OnAfterResponseProcess(controlId, actionName, lastRequestObject, xmlResponseObject) {
        &lt;span style="color: blue"&gt;var&lt;/span&gt; WebGrid1 = ISGetObject(controlId);
        &lt;span style="color: blue"&gt;var&lt;/span&gt; div1 = document.getElementById(&lt;span style="color: #a31515"&gt;"div1"&lt;/span&gt;);

        &lt;span style="color: blue"&gt;if&lt;/span&gt; (actionName == &lt;span style="color: #a31515"&gt;"Refresh"&lt;/span&gt;)
            div1.style.zIndex = 0;

        &lt;span style="color: blue"&gt;return true&lt;/span&gt;;
    }
    --&amp;gt;
&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;script&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;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;Hope this helps. If anyone has better idea, please kindly share with us. &lt;/span&gt;&lt;/p&gt;</description></item><item><title>Disable/Lock grid during refresh?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DisableLock-grid-during-refresh/</link><pubDate>Thu, 27 May 2010 13:35:38 GMT</pubDate><dc:creator>Gmontes</dc:creator><category>WebGrid</category><description>&lt;p&gt;Hi Glenn,&lt;/p&gt;&lt;p&gt;Yeah, I tried that as well... while it's true that it prevents you from interacting with the grid while the hourglass is displayed it doesn't quite cover the solution for spamming edits, you can still make the grid crash.&lt;/p&gt;
&lt;p&gt;Is there no way to disable the grid while refreshing?&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;</description></item><item><title>Disable/Lock grid during refresh?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DisableLock-grid-during-refresh/</link><pubDate>Wed, 26 May 2010 22:19:51 GMT</pubDate><dc:creator>Glayaar</dc:creator><category>WebGrid</category><description>You could try setting the &lt;em&gt;InProgressUIBehavior&lt;/em&gt; property under &lt;em&gt;LayoutSettings&lt;/em&gt; to &lt;em&gt;ChangeCursorToHourGlass&lt;/em&gt;. In my test, using the option will not allow you to interact with the grid when the grid is in process.&lt;br /&gt;</description></item><item><title>Disable/Lock grid during refresh?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DisableLock-grid-during-refresh/</link><pubDate>Wed, 26 May 2010 19:29:03 GMT</pubDate><dc:creator>Gmontes</dc:creator><category>WebGrid</category><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have a grid with a single updatable field and a read-only computed field. Everytime you edit the first field the read-only one should change (we need to do a DB call to re-calculate it according to whatever you just updated on the first). A refresh is needed for this, since I'm using an ObjectDataSource, I'm doing that onUpdated.&lt;/p&gt;
&lt;p&gt;My problem is... if you keep spamming changes/edits during that extra refresh the grid crashes. You can simulate this by modifying the BindToCustomObject sample in the R2 samples solution. Add on the ODS:&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;OnUpdated="RefreshGrid"&lt;/pre&gt;
&lt;p&gt; And on the Codebehind file:&lt;/p&gt;
&lt;p /&gt;
&lt;p /&gt;&lt;pre&gt;protected void RefreshGrid(object sender, ObjectDataSourceStatusEventArgs e)
    {
        WebGrid1.ClientAction.Refresh();
    }&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p /&gt;
&lt;p&gt;And try spamming changes on the region field... Is there a way to lock the grid during this flypostback to prevent this from happening? Or to prevent the users from spamming changes?&lt;/p&gt;
&lt;p&gt;I'm using  WebGrid 7.0.7200.401 and IE7&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item></channel></rss>