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

Hiding a column in edit mode

4 Answers 220 Views
Grid
This is a migrated thread and some comments may be shown as answers.
deepika
Top achievements
Rank 1
deepika asked on 15 Apr 2011, 09:13 PM
Hi

I want to display a column while adding a new record and normal display (ie.. in grid) but want to hide just in edit mode. Please let me know how can i achieve that both while using template columns and grid bound columns. Please respond to me ASAP.



Thanks,
Deepika

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 18 Apr 2011, 09:13 AM
Hello Deepika,

In order to hide the column in edit mode you should set its ReadOnly property to true. For further insight about the ReadOnly/Display/Visible properties of grid columns review this topic from the documentation:

http://www.telerik.com/help/aspnet-ajax/grid-using-columns.html (paragraph Visibility and rendering of columns)

All the best,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Peter
Top achievements
Rank 1
answered on 15 May 2014, 01:41 AM
I've set ReadOnly="true", but the item is still showing-up in edit mode - it displays as the following in edit mode: 

Current Hourly Rate:Telerik.Web.UI.GridInsertionObject
0
Peter
Top achievements
Rank 1
answered on 15 May 2014, 01:42 AM
Seems ReadOnly doesn't hide it... 

I may need to do something in code: http://www.telerik.com/forums/hide-display-column-in-edit-mode
0
Princy
Top achievements
Rank 1
answered on 17 May 2014, 12:36 PM
Hi Peter,

I guess you are using InPlace edit mode for editing your Grid. When a column is ReadOnly in this edit mode it will be shown in edit but disabled for edit. If you want to Hide it, you can try the following code snippet.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
  if (e.Item is GridEditableItem && e.Item.IsInEditMode)
  {
     GridEditableItem edit = (GridEditableItem)e.Item;
     edit["ColumnUniqueName"].Visible = false;
  }
}

Thanks,
Princy
Tags
Grid
Asked by
deepika
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Peter
Top achievements
Rank 1
Princy
Top achievements
Rank 1
Share this question
or