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

Editing only a few columns in RadGrid

3 Answers 504 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Katarina
Top achievements
Rank 1
Katarina asked on 27 Mar 2009, 02:17 PM
I want only some of columns to be editable in my RadGrid. I have GridEditCommandColumn, GridBoundColumns (for them I dont want to be editable) and GridTemplateColumns (they need to be editable). Is that possible and how?

3 Answers, 1 is accepted

Sort by
0
Todd Anglin
Top achievements
Rank 2
answered on 27 Mar 2009, 07:08 PM
For columns that you do not want to be editable, simply set the ReadOnly property on the columns to True. This will prevent them from going in to "edit mode" when a row is edited in your grid.

Hope that help!
-Todd
0
Shinu
Top achievements
Rank 2
answered on 30 Mar 2009, 07:19 AM
Hi Katarina,

You may also try the following code snippet to prevent editing for the GridBoundColumn in code behind.

CS:
 
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns) 
        { 
            if (col.ColumnType == "GridBoundColumn"
            { 
                GridBoundColumn boundCol = (GridBoundColumn)col; 
                 boundCol.ReadOnly = true
            } 
        } 
   } 

Regards
Shinu
0
Gowtama Krishna
Top achievements
Rank 1
answered on 14 Feb 2017, 05:15 PM
I have a Grid whose values are populated by data source and I want to edit the cells of a particular column so that the table gets updated in the database. The above suggestion setting Read Only doesn't seem to work now. Could you please provide me with any other solution.
Tags
Grid
Asked by
Katarina
Top achievements
Rank 1
Answers by
Todd Anglin
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Gowtama Krishna
Top achievements
Rank 1
Share this question
or