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

Conditionally Showing columns

2 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fred
Top achievements
Rank 1
Fred asked on 16 Apr 2012, 10:17 PM
Hi,
I Know i can write code like this to hide itens from grid in edit mode:

if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
   GridEditableItem item = e.Item as GridEditableItem;
    item["Price"].Visible = false;
 
}


But this way it only hiddes the data controls (a dropdownlist for example), leaving the label and the grid row visibles (this is in EditForms mode). Is there a way to hide this too ?

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 17 Apr 2012, 05:50 AM
Hello Fred,

Try setting the following which hides the label also.
C#:
GridEditableItem item = (GridEditableItem)e.Item;
item["Price"].Parent.Visible = false;

Thanks,
Shinu.
0
Fred
Top achievements
Rank 1
answered on 17 Apr 2012, 03:02 PM
Worked, thanks!
Tags
Grid
Asked by
Fred
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Fred
Top achievements
Rank 1
Share this question
or