Editing only a few columns in RadGrid

4 posts, 0 answers
  1. Katarina
    Katarina avatar
    17 posts
    Member since:
    Apr 2008

    Posted 27 Mar 2009 Link to this post

    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?
  2. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 27 Mar 2009 Link to this post

    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
  3. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 30 Mar 2009 Link to this post

    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
  4. Gowtama Krishna
    Gowtama Krishna avatar
    9 posts
    Member since:
    Aug 2016

    Posted 14 Feb in reply to Shinu Link to this post

    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.
Back to Top