﻿<?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 edit/delete through LayoutSetting doesn't work right in a flypostback action WebGrid7.0</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Disable-editdelete-through-LayoutSetting-doesnt-work-right-in-a-flypostback-action-WebGrid70/</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 edit/delete through LayoutSetting doesn't work right in a flypostback action WebGrid7.0</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Disable-editdelete-through-LayoutSetting-doesnt-work-right-in-a-flypostback-action-WebGrid70/</link><pubDate>Mon, 02 Nov 2009 04:29:31 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>It seems the property value in the JS code is case sensitive, so the correct snippet will be:&lt;div&gt;&lt;pre&gt;function setWebGridAccess(type) {
    var wg = ISGetObject('_webGrid');
    if (type == "read") {
        wg.RootTable.AllowEdit = "&lt;span style="background-color: rgb(255, 255, 255); "&gt;&lt;span style="color: rgb(255, 0, 0); "&gt;No&lt;/span&gt;&lt;/span&gt;";
        wg.RootTable.AllowDelete = "&lt;span style="color: rgb(255, 0, 0); "&gt;No&lt;/span&gt;";
        wg.RootTable.AllowAddNew = "&lt;span style="color: rgb(255, 0, 0); "&gt;No&lt;/span&gt;";
    }
    else {
        wg.RootTable.AllowEdit = "&lt;span style="color: rgb(255, 0, 0); "&gt;Yes&lt;/span&gt;";
        wg.RootTable.AllowDelete = "&lt;span style="color: rgb(255, 0, 0); "&gt;Yes&lt;/span&gt;";
        wg.RootTable.AllowAddNew = "&lt;span style="color: rgb(255, 0, 0); "&gt;Yes&lt;/span&gt;";
    }
}&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;</description></item><item><title>Disable edit/delete through LayoutSetting doesn't work right in a flypostback action WebGrid7.0</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Disable-editdelete-through-LayoutSetting-doesnt-work-right-in-a-flypostback-action-WebGrid70/</link><pubDate>Tue, 27 Oct 2009 10:55:29 GMT</pubDate><dc:creator>yuting</dc:creator><description>&lt;p&gt;You are right about disable editing and deleting in the client side but not for enable them. If I invoke JS function in InitializeLayout server side event to enable them, they will be disabled. So I have to remove the invoke script line, and then it is working. Here is the updated code snippet.&lt;/p&gt;
&lt;p&gt;How come enable editing/deleting doesn't have to set in the client side but disable does?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;pre&gt;protected void _webGrid_InitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e)
    {
        short fiscalYear = short.Parse(_fiscalYearList.SelectedValue);
        if (fiscalYear == 2009)
        {
            e.Layout.AllowAddNew = AddNew.Yes;
            e.Layout.AllowEdit = Edit.Yes;
            e.Layout.AllowDelete = Delete.Yes;

            //comment out this line, will make it to work.
            //_webGrid.ClientAction.InvokeScript("setWebGridAccess('write')");
        }
        else
        {
            e.Layout.AllowAddNew = AddNew.No;
            e.Layout.AllowEdit = Edit.No;
            e.Layout.AllowDelete = Delete.No;

            _webGrid.ClientAction.InvokeScript("setWebGridAccess('read')");
        }
    }&lt;/pre&gt;
</description></item><item><title>Disable edit/delete through LayoutSetting doesn't work right in a flypostback action WebGrid7.0</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Disable-editdelete-through-LayoutSetting-doesnt-work-right-in-a-flypostback-action-WebGrid70/</link><pubDate>Tue, 27 Oct 2009 06:31:33 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;You will need to set the property in the client side to disable editing and deleting completely. In order to achieve that, you will need to invoke JS function in InitializeLayout server side event. Here is the updated code snippet. For InitializeLayout server side event:&lt;/p&gt;&lt;pre&gt;protected void _webGrid_InitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e)&lt;br /&gt;{&lt;br /&gt;    short fiscalYear = short.Parse(_fiscalYearList.SelectedValue);&lt;br /&gt;    if (fiscalYear == 2009)&lt;br /&gt;    {&lt;br /&gt;        e.Layout.AllowAddNew = AddNew.Yes;&lt;br /&gt;        e.Layout.AllowEdit = Edit.Yes;&lt;br /&gt;        e.Layout.AllowDelete = Delete.Yes;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: rgb(255, 0, 0);"&gt;_webGrid.ClientAction.InvokeScript("setWebGridAccess('write')");&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;        e.Layout.AllowAddNew = AddNew.No;&lt;br /&gt;        e.Layout.AllowEdit = Edit.No;&lt;br /&gt;        e.Layout.AllowDelete = Delete.No;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: rgb(255, 0, 0);"&gt;_webGrid.ClientAction.InvokeScript("setWebGridAccess('read')");&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;Added JS function:&lt;/p&gt;&lt;pre&gt;function setWebGridAccess(type) {&lt;br /&gt;&lt;br /&gt;    var wg = ISGetObject('_webGrid');&lt;br /&gt;&lt;br /&gt;    if (type == "read") {&lt;br /&gt;        wg.RootTable.AllowEdit = "no";&lt;br /&gt;        wg.RootTable.AllowDelete = "no";&lt;br /&gt;        wg.RootTable.AllowAddNew = "no";&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        wg.RootTable.AllowEdit = "yes";&lt;br /&gt;        wg.RootTable.AllowDelete = "yes";&lt;br /&gt;        wg.RootTable.AllowAddNew = "yes";&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Disable edit/delete through LayoutSetting doesn't work right in a flypostback action WebGrid7.0</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Disable-editdelete-through-LayoutSetting-doesnt-work-right-in-a-flypostback-action-WebGrid70/</link><pubDate>Mon, 26 Oct 2009 15:33:32 GMT</pubDate><dc:creator>yuting</dc:creator><description>&lt;p&gt;I have a dropdownlist on the form and the selected value controls the edit mode of the webgrid on a flypostback action. I call webgrid.RefreshAll on list changes the selection.  On event &lt;span style="font-size: 13px"&gt;_webGrid_InitializeLayout, set the AllowAddNew, AllowEdit, AllowDelete&amp;nbsp;based on the list selection. When&amp;nbsp;&lt;span style="font-size: 13px"&gt;they&lt;/span&gt;&amp;nbsp;are all set to false, you got a client error when you tries to edit a cell, you can even&amp;nbsp;delete a row. You still got the Add New Row, Edit, Delete option on the context menu. The layoutsetting does not work correctly on a flypostback.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 13px"&gt;The attached is a working sample. Please check TestLayoutForm and try&amp;nbsp;selecting 2008.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Is this a bug? Please advise me how to make it work properly.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Yuting&lt;/p&gt;
</description></item></channel></rss>