Hide Grid Column but Show In editmode InPlace

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

    Posted 18 Dec 2009 Link to this post

    THis might be an odd question.  I have a grid that I want to hide the Active column on the grid.  The grid has editmode of InPlace.  When the user either adds new or edits the record I want to display more columns.  Is this possible?
  2. Johny
    Johny avatar
    80 posts
    Member since:
    Aug 2008

    Posted 19 Dec 2009 Link to this post

    Hi Eric,

    Here is a link that might be useful in your case:

    http://www.telerik.com/help/aspnet-ajax/griddifferenteditinsertformswithautogeneratedform.html

    Thanks,
    Johny
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Dec 2009 Link to this post

    Hi Eric,

    You can try out the following approach to hide certain columns, when the grid is in Insert mode but display them in Edit mode.
    c#:
     protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
        { 
            foreach (GridColumn col in RadGrid1.Columns) 
            { 
                if (col.ColumnType == "GridBoundColumn" && col.UniqueName == "ColumnUniqueName"
                { 
                    if (e.CommandName == RadGrid.EditCommandName) 
                    { 
                        (col as GridBoundColumn).ReadOnly = false
                        col.Visible = true
                    } 
                    else 
                    {                     
                        (col as GridBoundColumn).ReadOnly = true
                        col.Visible = false
                    } 
                } 
            }   
         } 

    Thanks
    Princy.
Back to Top