I have a WebHierarchicalDataGrid in place and its works fine if i had data in both the parent and child tables.
Say, if i clear my child table referered in the Grid and display the grid. I get the Parent rows visible but i cannot see the expand/collapse button.
Yes, since there are no data in the child table it does not show the expand/collapse button.
But , what i need is to show the expand/collapse button and once i click that the Add new row should be visible.
Suggest me to proceed further.
Hey,
If I understand you correctly, you want a parent level with data. There is a child level that starts out empty, but shows the add row? If this is the case, it is fairly easy to implement. On your aspx (or in code behind), set up the hierarchical grid so that the child level is defined. Now, if you just want the add row in the child, define the row adding behavior in just the child band, otherwise you can put it on the top level with EnableInheritance set to true on EditingCore and RowAdding. The grid checks for the presence of the add row and will render an empty child with it if that behavior is enabled.
Hope this helps.
regards,
David Young
Hi David,
Thanks for your reply. Ur suggestion sorted out my problem.
One more thing is that my parent band is read only. The above issue worked once i set Enable=true and EnableInheritance=true for the top level.
So what i did is that set the 2 properties to true and set the visibility of the top level add new row to hidden in add new row css style in Row adding behaviour.
Is that the only option..Suggest..
All i need is the user can only add/delete/edit the child band data and not the parent data.
Thanks..
As I said, you can just add the behaviors to just the child band rather than the top level. I'll show some code here to show what I mean.
<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" Width="400px" Height="400px" DataSourceID="" DefaultColumnWidth="" Key="Root" DataKeyFields="Id" EnableAjax="true" AutoGenerateBands="false" AutoGenerateColumns="false" InitialDataBindDepth="-1"> <Columns> <ig:BoundDataField DataFieldName="Id" Key="Id"> <Header Text="Id" /> <Footer Text="ident" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="BirthDate" Key="BirthDate"> <Header Text="BirthDate" /> <Footer Text="bday" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Name" Key="Name" Hidden="false"> <Header Text="Name" /> <Footer Text="nombre" /> </ig:BoundDataField> </Columns> <Bands> <ig:Band Height="200px" DataMember="Children1" DataKeyFields="Id" AutoGenerateColumns="false" ShowFooter="false" Key="one"> <Columns> <ig:BoundDataField DataFieldName="Id" Key="Id"> <Header Text="Id" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="BirthDate" Key="BirthDate"> <Header Text="BirthDate" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Name" Key="Name"> <Header Text="Name" /> </ig:BoundDataField> </Columns> <Behaviors> <ig:EditingCore> <Behaviors> <ig:RowAdding> </ig:RowAdding> <ig:CellEditing> </ig:CellEditing> </Behaviors> </ig:EditingCore> </Behaviors> </ig:Band> </Bands> <Behaviors> <ig:Activation ActiveCellCssClass="activeCell"> </ig:Activation> </Behaviors> </ig:WebHierarchicalDataGrid>
In this grid, only add and editing will be available in the child grid. It won't even be possible to edit the top level through code. It will be read only as you wish.
Dave
Dave,
Thanks for your code snippet.
I had fixed that issue..
And thanks for your support as well.
Shankar