Afendi Hamat
Top achievements
Rank 1
Afendi Hamat
asked on 20 Jul 2008, 09:28 AM
Hi all,
how do i hide a grid command item display if a certain condition is met in the code behind? Is this possible?
Thanks in advance.
how do i hide a grid command item display if a certain condition is met in the code behind? Is this possible?
Thanks in advance.
6 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 21 Jul 2008, 03:52 AM
Hello Afendi,
Try setting the visibility of the GridCommandItem as shown in the code snippet below.
Thanks
Princy.
Try setting the visibility of the GridCommandItem as shown in the code snippet below.
| RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; |
| RadGrid1.Rebind(); |
Thanks
Princy.
0
Afendi Hamat
Top achievements
Rank 1
answered on 21 Jul 2008, 06:15 AM
Thanks Princy.
0
Shinu
Top achievements
Rank 2
answered on 21 Jul 2008, 07:43 AM
Hi,
You can also go through the following help article to get more details about the CommandItem in RadGrid.
CommandItem
Shinu.
You can also go through the following help article to get more details about the CommandItem in RadGrid.
CommandItem
Shinu.
0
Nuno
Top achievements
Rank 1
answered on 21 Sep 2009, 03:00 PM
Hi all,
I'm trying to do:
I'm trying to do:
RadGrid1.MasterTableView.DetailTables[0].CommandItemDisplay =
GridCommandItemDisplay.None;
and CommandItemDisplay of the Detail Table stills showing up. Even if do RadGrid1.MasterTableView.DetailTables[0].rebind();
Any help is very appreciated.
Nuno Sénica.
0
Shinu
Top achievements
Rank 2
answered on 22 Sep 2009, 06:36 AM
Hello Nuno,
I tried the same code and found that it was not working. But then probably you can work around this using the following code. You can check for the gridtableview using its Name property and then hide the CommandItem.
c# :
| protected void RadGrid1_PreRender(object sender, EventArgs e) |
| { |
| foreach (GridDataItem item in RadGrid1.Items) |
| { |
| if (item.OwnerTableView.Name == "Detail") |
| { |
| item.OwnerTableView.CommandItemDisplay = GridCommandItemDisplay.None; |
| item.OwnerTableView.Rebind(); |
| } |
| } |
| } |
Thanks
Shinu.
0
Nuno
Top achievements
Rank 1
answered on 22 Sep 2009, 09:41 AM
Hi Shinu,
You're the one! : )
Thank you.
P.S. - Telerik, please fix this issue : )
Nuno.