Hi All,
I am using hierarchical grid which shows categories and its details.
Now i want to show / hide columns which are in detail table depending on category.
as follows, C1, C2 are categories and A, B, C are columns...
-C1
A B C
-C2
A C
Please help me to solve my problem.
Thanks,
Amol Wable
I am using hierarchical grid which shows categories and its details.
Now i want to show / hide columns which are in detail table depending on category.
as follows, C1, C2 are categories and A, B, C are columns...
-C1
A B C
-C2
A C
Please help me to solve my problem.
Thanks,
Amol Wable
5 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 19 Feb 2009, 12:20 PM
Hello Amol,
You can try out the following code to hide columns in the DetailTable based on the cell values in its parent row:
cs:
Thanks
Princy.
You can try out the following code to hide columns in the DetailTable based on the cell values in its parent row:
cs:
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items) |
{ |
if (dataItem.Expanded) |
{ |
GridTableView nestedTable = (GridTableView)dataItem.ChildItem.NestedTableViews[0]; |
if (dataItem["Category"].Text == "C2") |
{ |
nestedTable.GetColumnSafe("ColumnBUniqueName").Visible = false; |
} |
} |
} |
} |
Thanks
Princy.
0
Amol
Top achievements
Rank 2
answered on 20 Feb 2009, 06:44 AM
Excellent Princy,
It works fine.
Thanks,
Amol Wable
It works fine.
Thanks,
Amol Wable
0
Shinu
Top achievements
Rank 2
answered on 20 Feb 2009, 07:14 AM
Hi Amol,
You can also refer the following help article which explains how to loop through detail tables in a hierarchical Grid.
Traversing detail tables/items in Telerik RadGrid
Thanks
Shinu
You can also refer the following help article which explains how to loop through detail tables in a hierarchical Grid.
Traversing detail tables/items in Telerik RadGrid
Thanks
Shinu
0
Mihir
Top achievements
Rank 1
answered on 27 Jul 2012, 11:45 AM
Hi Princy,
In my case, columns are defined as the part of MasterTableView. I want to hide the columns based on my code. So where should I exactly write the code to set the visibility false.
At the moment I have defined it in ItemDataBound event but as it will fired this events for all items in my Grid, can i move it somewhere else where this visibility doesn't need to execute for all items...
Thanks,
Mihir
In my case, columns are defined as the part of MasterTableView. I want to hide the columns based on my code. So where should I exactly write the code to set the visibility false.
At the moment I have defined it in ItemDataBound event but as it will fired this events for all items in my Grid, can i move it somewhere else where this visibility doesn't need to execute for all items...
Thanks,
Mihir
0
Shinu
Top achievements
Rank 2
answered on 30 Jul 2012, 07:29 AM
Hi,
Try hiding the column in prerender event as shown below.
C#:
Thanks,
Shinu.
Try hiding the column in prerender event as shown below.
C#:
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
RadGrid1.MasterTableView.GetColumn(
"UniqueName"
).Display =
false
;
}
Thanks,
Shinu.