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

Hide Expand on ServerOnDemand Grid?

3 Answers 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fred
Top achievements
Rank 1
Fred asked on 05 Aug 2009, 02:56 PM
I've searched and looked up on how to hide Expand/Collapse but seems to only work if you already have all the data.
there a way to do it with ServerOnDemand loading? 

If I try this http://www.telerik.com/help/aspnet/grid/grdhideexpandcollapseimageswhennorecords.html
All the expand/collapse buttons go away. I'm assuming because the grid doesn't know if the row has child items or not. I have a dataset with three tables loaded already, there a way to check to see if each row will have child items and then hide/show the expand?

3 Answers, 1 is accepted

Sort by
0
Accepted
Yavor
Telerik team
answered on 10 Aug 2009, 08:41 AM
Hello Fred,

Basically, the approach in question relies on a check on the presence of detail records, when hiding the expand collapse images. Since you are using server on demand, there is no child records at this time. Hence the issue.
You have two possible options to work-around this.
First, you can allow the child levels to be populated.
Alternatively, you can query the database, to determine if a given record would have child records. then, you can hide the expand/collapse image based on this information.
I hope one of these options is suitable for you.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Bob
Top achievements
Rank 1
answered on 04 Feb 2011, 07:22 PM
I am using a three level hierarchical RadGrid and have this issue.

Using the second option "Alternatively, you can query the database, to determine if a given record would have child records. then, you can hide the expand/collapse image based on this information." could you explain where to do the check and how exactly to hide the image, .ColumnCreating, ColumnCreated. DataBind?

Thanks in advance.
0
Iana Tsolova
Telerik team
answered on 10 Feb 2011, 10:31 AM
Hi Bob,

You can handle the ItemDataBound event for that purpose. If fires for each GridItem when it is bound. Thus if the current item is GridDataItem of the MasterTableView, you can get the desired information from it to query the database and see if there are child records for it. Here you can also hide the expand button.
For more information, check the below articles:
http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html
http://www.telerik.com/help/aspnet-ajax/grddistinguishgridrowsinhierarchyonitemdatabound.html
http://www.telerik.com/help/aspnet-ajax/grdhideexpandcollapseimageswhennorecords.html 

All the best,
Iana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Fred
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Bob
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or