RadGrid Edit Column

3 posts, 1 answers
  1. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 18 Sep 2009 Link to this post

    Is there a way in the RadGrid that when you hir the edit button a column is not editable but when you hit Insert You can still enter data.

    I tried making a column Read only which it does not show up when the user hits the edit button, but it is alos not showing when the user hits the insert button.  I would like one field to be locked when editing but still allow the user to enter a value when entering a brand new record.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 Sep 2009 Link to this post

    Hello Eric,

    Try out the following code to hide the column in Edit mode but display it in Insert mode:
    c#:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
        {       
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode) && (!e.Item.OwnerTableView.IsItemInserted)) 
            { 
     
                GridEditFormItem item = (GridEditFormItem)e.Item;            
                item["ColumnUniqueName"].Parent.Visible = false
              
            }  
        } 

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 21 Sep 2009 Link to this post

    Thanks that is perfect..
Back to Top