Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
Get Hirarchical Grid value of Checked Bands having N Childs in Code behind in c#
posted

 I am Implementing Web Hierarchical Data Grid and on Save i want to Get the Checked Rows Id's on Code Behind.

<ig:WebHierarchicalDataGrid ID="hdgEnterExit" runat="server" EnableRelativeLayout="True" ShowFooter="False" HeaderCaptionCssClass="HeaderCaptionClass" ItemCssClass="ItemCssClass"
AltItemCssClass="AltItemCssClass" FooterCaptionCssClass="HeaderCaptionClass" AutoGenerateColumns="False" AutoGenerateBands="True"
DataMember="Module"
DataKeyFields="Module_Id"
InitialDataBindDepth="-1"
Width="860px"
EnableDataViewState="true" EnableViewState="true">

<Columns>
<ig:BoundDataField DataFieldName="Module_Id" Key="Module_Id" Footer-Text="Module_Id" Header-Text="Module_Id" CssClass="CenterAlign" Width="70">
</ig:BoundDataField>
</Columns>
<Columns>
<ig:BoundDataField DataFieldName="Module_Label" Key="Module_Label" Footer-Text="Module_Label" Header-Text="Module_Label" CssClass="CenterAlign" Width="120">
</ig:BoundDataField>
</Columns>


<Bands>
<ig:Band Key="Trn_Id" AutoGenerateColumns="false" DataMember="TRN_CODE" DataKeyFields="Trn_Id">
<Columns>
<ig:BoundDataField DataFieldName="Menu_Label" Key="Menu_Label" Header-Text="Menu_Label" CssClass="CenterAlign" Width="520">
</ig:BoundDataField>
</Columns>

<Bands>
<ig:Band Key="Trn_Id" AutoGenerateColumns="false" DataMember="TRN_Operations" DataKeyFields="Trn_Id,Operation_Id">
<Columns>
<ig:BoundDataField DataFieldName="Operation_Id" Key="Operation_Id" Header-Text="Operation_Id" CssClass="CenterAlign" Width="420">
</ig:BoundDataField>
<ig:BoundCheckBoxField DataFieldName="Operation" DataType="System.Boolean"
VisibleIndex="1" Key="Operation" Width="180px">
<Header Text="Operation" >

</Header>
</ig:BoundCheckBoxField>
</Columns>
<Bands>
</Bands>
</ig:Band>
</Bands>
</ig:Band>
</Bands>
<Behaviors>
<ig:EditingCore EnableInheritance="True" Enabled="true">
<EditingClientEvents CellValueChanging="WebHierarchicalDataGrid1_Editing_CellValueChanging"/>
<Behaviors>
<ig:CellEditing EnableInheritance="true">
<EditModeActions EnableOnActive="True" MouseClick="Single" />
</ig:CellEditing>
</Behaviors>
</ig:EditingCore>
</Behaviors>
</ig:WebHierarchicalDataGrid>

Parents
No Data
Reply
  • 1560
    Offline posted

    Hello,

    I have been looking into your requirement and prepared a small sample in order to demonstrate how such behavior could be achieved.

    I added an UnboundCheckboxColumn to the grid bands column collection and on click on the Save button, I looped through all rows and bands and check the value of the check box. Based on this value I'm adding the row id and level to a globally defined list.

    Please keep in mind that in order to have access to the RowIslands on the server-side when the button is clicked you should disable the EnableDataViewState property and re-bind the grid again so the islands would be generated.

    Attached you will find my sample for your reference. Please test it on your side and let me know if I may be of any further assistance.

    Sincerely,

    Teodosia Hristodorova

    Associate Software Developer

    6318.WHDG_get_checked_rows.zip

Children