﻿<?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 - The Problem of Selecting all checkboxs by clicking the checkbox of the column header</title><link>http://www.intersoftsolutions.com/Community/WebGrid/The-Problem-of-Selecting-all-checkboxs-by-clicking-the-checkbox-of-the-column-header/</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>The Problem of Selecting all checkboxs by clicking the checkbox of the column header</title><link>http://www.intersoftsolutions.com/Community/WebGrid/The-Problem-of-Selecting-all-checkboxs-by-clicking-the-checkbox-of-the-column-header/</link><pubDate>Fri, 02 Sep 2011 00:35:20 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;It is different from normal scenario. In Flat or normal WebGrid, we have ISRowChecker which will check or uncheck rows when the checkbox header clicked. However, in grouping, hierarchical or even in SelfReference, you might see that the child level is not checked. This is default behaviour. &lt;br /&gt;Since this is not a treeview, even though the parent row is checked, the child will not be checked. &lt;br /&gt;Our checkbox is only for a flag for the current row. That's why it does not designed for the other level.&lt;br /&gt;Same result with your custom checkbox. I think you used logic to check the loaded row. However, it can only be applied for one level (parent).&lt;br /&gt;You will need to add additional code to get the selfreference child rows and check them manually.&lt;/p&gt;
&lt;p&gt;Regarding the expand in SelfReference, when there is a flypostback request such as sort,refresh, update, etc, WebGrid would collapse the level again. We don't have any property to handle that scenario for now.&lt;br /&gt;I suggest you to expand all the row at first load. With this way, it will not get closed.&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt; protected void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
    {
        if (e.Row.SelfRefChildren != null)
        {
            e.Row.ExpandSelfRefRow();
        }
    }&lt;/pre&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;
&lt;p /&gt;</description></item><item><title>The Problem of Selecting all checkboxs by clicking the checkbox of the column header</title><link>http://www.intersoftsolutions.com/Community/WebGrid/The-Problem-of-Selecting-all-checkboxs-by-clicking-the-checkbox-of-the-column-header/</link><pubDate>Thu, 01 Sep 2011 22:08:41 GMT</pubDate><dc:creator>gavin</dc:creator><description>&lt;p&gt;&lt;span style="font-size: 11pt"&gt;&amp;nbsp;Hi , &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 11pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I meet another problem about using SelfReferencingSettings . If the parent node has some childnodes , how can I set to make the childnodes AUTOexpand when page&amp;nbsp;is loading&amp;nbsp;? Besides that , when I modify&amp;nbsp;some content of the childnode and click the button of Save , how can I set to make the childnode keep expanding ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;    &lt;span style="font-size: 11pt"&gt;Who can help me ? Thanks a lot !&lt;/span&gt;&lt;/p&gt;</description></item><item><title>The Problem of Selecting all checkboxs by clicking the checkbox of the column header</title><link>http://www.intersoftsolutions.com/Community/WebGrid/The-Problem-of-Selecting-all-checkboxs-by-clicking-the-checkbox-of-the-column-header/</link><pubDate>Thu, 01 Sep 2011 04:16:14 GMT</pubDate><dc:creator>gavin</dc:creator><description>&lt;p&gt;&lt;span style="font-size: 11pt"&gt;Hi ,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 11pt"&gt;&amp;nbsp;&amp;nbsp; In the webgrid , when I want to select all checkboxs of a column through clicking the checkbox of the column header&amp;nbsp;, I&amp;nbsp;meet a problem . The picture in the attachment file describes this issue . &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 11pt"&gt;&amp;nbsp; In the foreground Program , I use the SelfReferencingSettings . When I click the checkbox of the column header to select all checkboxs of this column , the first layer checkboxs can be selected . If a parent row has some child rows , the checkbox of the parent row can be selected , but the checkboxs of these child rows can not be selected . &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 11pt"&gt;&amp;nbsp; The following is the key code of the foreground program . &lt;/span&gt;&lt;/p&gt;&lt;pre&gt; &amp;lt;ISWebGrid:WebGrid ID="WG1" runat="server" UseDefaultStyle="True" DefaultStyleMode="Win7"
            Height="100%" OnInitializeDataSource="WG1_InitializeDataSource" 
            OnBatchUpdate="WG1_BatchUpdate" &amp;gt;
   &amp;lt;RootTable GridLineStyle="NotSet" DataKeyField="ModuleGuid"&amp;gt;
       &amp;lt;SelfReferencingSettings ChildDataMember="ParentModuleCode" Enabled="True"  
              IsTreeViewSelectionMode="false"ExpandColumnMember="ModuleName"             
                   ParentDataMember="ModuleCode" /&amp;gt;
       &amp;lt;Columns&amp;gt;
       &amp;lt;/Columns&amp;gt;
   &amp;lt;/RootTable&amp;gt;
&amp;lt;LayoutSettings AllowSorting="Yes" AllowSelectColumns="Yes" AlwaysShowHelpButton="false"
      AllowEdit="Yes" AllowMultipleSelection="No" AllowColumnFreezing="No"   
     StatusBarVisible="true" AllowBatchUpdate="true" AutoHeight="true" AutoWidth="false"  
             AutoFitColumns="true"AllowGrouping="No" PagingMode="ClassicPaging"  
                 PagingLoadMode="Automatic" PagingSize="50"&amp;gt;
     &amp;lt;ClientSideEvents OnAfterInitialize="WG1_OnAfterInitialize" 
                 OnRowContextMenu="WG1_OnRowContextMenu"
  OnEnterEditMode="WG1_OnEnterEditMode" OnAfterExitEditMode="WG1_OnAfterExitEditMode" /&amp;gt;
     &amp;lt;TextSettings Language="UseCustom" UseLanguage="zh-CN"&amp;gt;
     &amp;lt;/TextSettings&amp;gt;
     &amp;lt;HeaderStyle CssClass="WG-Header" /&amp;gt;
     &amp;lt;RowHeaderStyle CssClass="WG-RH"&amp;gt;
     &amp;lt;/RowHeaderStyle&amp;gt;
     &amp;lt;RowStyle CssClass="WG-Row"&amp;gt;&amp;lt;/RowStyle&amp;gt;
     &amp;lt;AlternatingRowStyle CssClass="WG-AR" /&amp;gt;
     &amp;lt;SelectedRowStyle CssClass="WG-SR" /&amp;gt;
     &amp;lt;LostFocusRowStyle CssClass="WG-LFR"&amp;gt;
     &amp;lt;/LostFocusRowStyle&amp;gt;
     &amp;lt;EditTextboxStyle CssClass="WG7W-ET"&amp;gt;
     &amp;lt;/EditTextboxStyle&amp;gt;
     &amp;lt;ClientSideEvents OnAfterInitialize="WG1_OnAfterInitialize"  
       OnRowContextMenu="WG1_OnRowContextMenu"OnCheckBoxClick="WG1_OnCheckBoxClick" /&amp;gt;
     &amp;lt;/LayoutSettings&amp;gt;
&amp;lt;/ISWebGrid:WebGrid&amp;gt; 

&lt;/pre&gt;
&lt;p&gt;  &lt;span style="font-size: 11pt"&gt;The following is&amp;nbsp;the key code of&amp;nbsp; creating&amp;nbsp;a column of webgrid&amp;nbsp;. &lt;/span&gt;&lt;/p&gt;&lt;pre&gt;   wgCol0 = new WebGridColumn();
   int Index = chkRoleList.Items.Count - RemoveCount;
   wgCol0.Caption = "完全公开" &amp;#43; "&amp;lt;input type=\"checkbox\" onclick=\"SelectAllColumn(this)\" name=\"" &amp;#43; Index &amp;#43; "_chk_完全公开_" &amp;#43; "\"&amp;gt;";
   wgCol0.ColumnType = ColumnType.CheckBox;
   wgCol0.CellStyle.HorizontalAlign = ISNet.WebUI.HorizontalAlign.Center;
   wgCol0.Name = "完全公开";
   wgCol0.EditType = EditType.Checkbox;
   wgCol0.DataType = "System.Boolean";
   wgCol0.Width = 100;
   wgCol0.IsAutoWidth = false;
   wgCol0.AllowSorting = Sorting.No;
   wgCol0.DataMember = "完全公开";
   wgCol0.CellStyle.HorizontalAlign = ISNet.WebUI.HorizontalAlign.Center;
   WG1.RootTable.Columns.Add(wgCol0);&lt;/pre&gt;
&lt;p&gt; &lt;span style="font-size: 11pt"&gt;&amp;nbsp; The following is the javascript method of selecting all checkboxs by clicking the checkbox of the column header .&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;function SelectAllColumn(obj) {
            var grid = ISGetObject("&amp;lt;%= WG1.ClientID %&amp;gt;");
            var index = obj.name.split('_');
            var cellIndex = parseInt(index[0]) &amp;#43; 1;
            for (i = 0; i &amp;lt; grid.TotalLoadedRows; i&amp;#43;&amp;#43;) {
                var row = grid.RootTable.GetRow(i);
                var cell = row.GetCells()[cellIndex];
                if (obj.checked) {
                    cell.SetValue(true, true);
                }
                else {
                    var cbxElement = cell.GetElement().childNodes[0];
                    cbxElement.click();
                    cbxElement.checked = false;
                }
                cell.ActivateEdit();
                grid.MarkEdit();
                grid.ExitEdit(1, 0, 0);
            }
        }&lt;/pre&gt;
&lt;p&gt;   &lt;span style="font-size: 11pt"&gt;Anyone can help me to solve this issue ? Thanks a lot !&lt;/span&gt;&lt;/p&gt;</description></item></channel></rss>