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

Hide Grid Column but Show In editmode InPlace

2 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric Klein
Top achievements
Rank 1
Eric Klein asked on 18 Dec 2009, 02:35 PM
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 Answers, 1 is accepted

Sort by
0
Johny
Top achievements
Rank 1
answered on 19 Dec 2009, 07:05 AM
Hi Eric,

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

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

Thanks,
Johny
0
Princy
Top achievements
Rank 2
answered on 21 Dec 2009, 06:12 AM
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.
Tags
Grid
Asked by
Eric Klein
Top achievements
Rank 1
Answers by
Johny
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or