Edit Mode and Readonly columns

4 posts, 0 answers
  1. Edward
    Edward avatar
    20 posts
    Member since:
    Mar 2009

    Posted 13 Apr 2009 Link to this post

    I have grid with some readonly columns.  When entering to edit mode I want the user to be able to see the value of the readonly column.  Readonly column values disappear in edit mode.
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 14 Apr 2009 Link to this post

    Hi Edward,

    Editable column types (column types that implement the IGridEditableColumn interface) have a ReadOnly property that determines whether the column editor is visible in the edit form.
    Please note that when ReadOnly property is set to True, the column editor does not appear in the edit form.
    Find more information in the following article:
    Column types

    Kind regards,
    Pavlina
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Edward
    Edward avatar
    20 posts
    Member since:
    Mar 2009

    Posted 14 Apr 2009 Link to this post

    Thanks - I can see that the column does not appear.  I guess what I am asking is how do show the value of a column in the grid in edit mode, but prevent the user from changing the data.

    For instance take the following table data
          Order  Name
    Edit 3         Item 3
    Edit 1         Item 1
    Edit 4         Item 4
    Edit 5         Item 5
    Edit 2         Item 6

    When I click Edit I want the user to be able to change the value in the [Order] Column but not in the Name column.  However the name column should be visible during the edit.

    Thanks,
    Ed

  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 Apr 2009 Link to this post

    Hi Edward,

    Try disabling the TextBox that appear for the Name Column while in edit mode as shown below.

    CS:
     
     protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode)) 
            { 
                GridEditFormItem edititem = (GridEditFormItem)e.Item; 
                TextBox txtbx = (TextBox)edititem["Name"].Controls[0]; 
                txtbx.Enabled = false
            } 
       } 


    Thanks
    Shinu
Back to Top