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

ExpandCollapseColumn show/hide from code behind

3 Answers 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkata
Top achievements
Rank 1
Venkata asked on 15 Aug 2011, 08:46 PM
Hi,
I want to show/hide ExpandCollapseColumn based on some Boolean  condition from C# Code behind.

here is my code..
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
             if(! bShowExpandColumn)
              (e.Item as GridDataItem)["ExpandColumn"].Visible = false;
    }
}

it's hiding "ExpandCollapseColumn" But the problem is the next column moved to the left.

How can i do this?

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Aug 2011, 06:48 AM
Hello Venkata,

Try the following code snippet to achieve your scenario.
C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridDataItem)
       {
           if (!bShowExpandColumn)
           {
               TableCell cell =(TableCell)(e.Item as GridDataItem)["ExpandColumn"];
               cell.Controls[0].Visible = false;
           }
       }
   }

Thanks,
Shinu.
0
Venkata
Top achievements
Rank 1
answered on 18 Aug 2011, 09:14 PM
Thanks for quick reply.

but my problem is i have "three level hierarchy" radgrid
MasterTable --> DetailsTable --> DetailsTable

i gone throw this example
http://www.telerik.com/help/aspnet-ajax/grid-hide-expand-collapse-images-when-no-records.html

 but ExpandCollapseColumn hiding on First Level it's not hiding on 2nd level

How can i do it for "Three level hierarchy" Radgrid ?



 

0
Venkata
Top achievements
Rank 1
answered on 18 Aug 2011, 09:21 PM
Never mind i forgot to put "HierarchyLoadMode="ServerBind" on my DetailsTable GridTableView.


Thanks
Tags
Grid
Asked by
Venkata
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Venkata
Top achievements
Rank 1
Share this question
or