Hi , i am setting the parent grid row expand or collapse based on condition for each parent row from code behind based on condiion.
like below..
e.Item.OwnerTableView.HierarchyDefaultExpanded =true
Problem:
still the expand/collapse image icon showing "+" icon instead of "-".
Thanks,
Satish.
7 Answers, 1 is accepted
Continuation to the post ..
The code to expand/collapse particular detail grid written RadGrid_ItemDataBound event. The Detail grid showing in expand mode correctly only .
Private Sub rgMyConnections_ItemDataBound(sender As Object, e As GridItemEventArgs) Handles rgMyConnections.ItemDataBound
If e.Item.OwnerTableView.Name = "SourceTable" Then
......other code to get isExpand
e.Item.OwnerTableView.HierarchyDefaultExpanded =isExpand
End if.
Issue :the expand/collapse image icon showing "+" icon instead of "-".
Please note that the HierarchyDefaultExpanded is a global property and it affects all the grid items. The specific settings which will control the expand state of the individual items is called Expanded:
http://www.telerik.com/help/aspnet-ajax/grid-single-expand-in-hierarchical-grid.html
Try to replace it in your logic either in ItemDataBound or ItemCreated and let me know if it works for you.
Regards,
Eyup
Telerik
See What's Next in App Development. Register for TelerikNEXT.
Hi Eyup,
Thanks for your reply..still i am facing the issue.
item.expanded is not working if i want to set particular parent row based on condition.
if condition then
item.expanded=true
end
if i remove condition all items are expanded.. i tried in itemdatabound and itemcreated events.
Thanks,
Satish.
Could you try changing the HierarchyLoadMode property and let me know about the result?
<
MasterTableView
...
HierarchyLoadMode
=
"ServerBind"
>
Looking forward to your reply.
Regards,
Eyup
Telerik
Hi Eyup. Still it not solved my problem .
i changed to code HierarchyLoadMode="ServerBind" and e.Item.Expanded = isExpand in ItemDatabind..
Please refer attached screen..
i want to display grid like Expnad Mode image.
Please share me any example code if you have.
Thanks,
Satish.
Hi Eyup,
It working fine for me if i write the code inRadGrid1_PreRender event.
like below
Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender
RadGrid1.MasterTableView.Items(0).Expanded = True
end sub
FYI..
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/declarative-relations/defaultvb.aspx?show-source=true
Thanks,
Satish.
I'm glad you've managed to resolve the issue and thank you for sharing the solution for this case with our community.
Please feel free to turn to us if new questions arise.
Regards,
Eyup
Telerik