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

Hiding expand/collapse images when no records

2 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nilanjan
Top achievements
Rank 1
Nilanjan asked on 09 Dec 2008, 02:50 PM

I am using rad grid in hierarchical mode in my project.
Some of the rows in parent do not have child records, so i am removing the 'plus' sign for those rows. However the rows
are getting misalligned and looking dirty, typically  a white border is coming to the left and bottom the cell of the 'plus' sign.

I am not able to provide scrrenshot, otherwise i would have done so.
I have posted a lot of queries before and obtained solution very quickly from your side. So thanks in advance.
Pls advice.

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 12 Dec 2008, 08:56 AM
Hi Nilanjan,

Are you removing the button control completely? If this is the case I you may try inserting a &nbps; at its place. However I suggestion you to consider if appropriate in your scenario to only set button's visibility to false, as it is described in this help article.

Please give it a try and let us know about the result.

Kind regards,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nilanjan
Top achievements
Rank 1
answered on 15 Dec 2008, 09:25 AM
I was doing exactly as it is suggested in the help article link, i.e. hiding the button recursively in the radgrid prerender event, however the problem persisted - the expand collapse column looked messy.

But adding an " "  solved it. Great tip and thank you once again.

GridItem

[] nestedViewItems = ragInformationRequestList.MasterTableView.GetItems(GridItemType.NestedView);

 

 

foreach (GridNestedViewItem nestedViewItem in nestedViewItems)

 

{

 

  foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)

 

  {

 

    if (nestedView.Items.Count == 0)

 

    {

 

        TableCell cell = nestedView.ParentItem["ExpandColumn"];

 

        cell.Controls.Add(

new LiteralControl(" "));//added as per rad team suggestion.

 

        cell.Controls[0].Visible =

false;

 

        nestedViewItem.Visible =

false;

 

    }

 }

}

Tags
Grid
Asked by
Nilanjan
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Nilanjan
Top achievements
Rank 1
Share this question
or