This is a migrated thread and some comments may be shown as answers.

Expand and Collapse image UI from code behind

7 Answers 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Satish
Top achievements
Rank 1
Satish asked on 06 May 2015, 10:25 AM

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

Sort by
0
Satish
Top achievements
Rank 1
answered on 08 May 2015, 10:30 AM

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 "-".

 

 

0
Eyup
Telerik team
answered on 11 May 2015, 07:22 AM
Hi Satish,

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.

 
0
Satish
Top achievements
Rank 1
answered on 12 May 2015, 01:21 PM

 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.

 

0
Eyup
Telerik team
answered on 15 May 2015, 12:08 PM
Hello 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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Satish
Top achievements
Rank 1
answered on 15 May 2015, 02:38 PM

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.

 

 

0
Satish
Top achievements
Rank 1
answered on 18 May 2015, 11:45 AM

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.

0
Eyup
Telerik team
answered on 20 May 2015, 07:43 AM
Hi 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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Satish
Top achievements
Rank 1
Answers by
Satish
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or