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

Edit form settings

2 Answers 185 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jessica
Top achievements
Rank 1
Jessica asked on 02 Aug 2010, 06:48 PM
Hello,
In the Edit form, is there a way to change whether an item is visible in the edit form through code.  I know that you can set the property of the column to read only, but how would you do that in default.aspx.cs

Thank you.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Aug 2010, 06:43 AM
Hello Jessica,

Try the following code snippet to change the visibility of an item in edit form .

ASPX:
<telerik:GridBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" UniqueName="EmployeeID">
</telerik:GridBoundColumn>

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
      if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
       {
           GridEditFormItem editForm = (GridEditFormItem)e.Item;
           editForm["EmployeeID"].Parent.Visible = false; // hide the column
       }
   }

Thanks,
Princy.
0
Nguyen
Top achievements
Rank 1
answered on 22 Apr 2011, 04:34 AM
Thanks
Tags
Grid
Asked by
Jessica
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Nguyen
Top achievements
Rank 1
Share this question
or