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

Edit Mode and Readonly columns

3 Answers 163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 13 Apr 2009, 04:08 PM
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.

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 14 Apr 2009, 07:19 AM
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.
0
Edward
Top achievements
Rank 1
answered on 14 Apr 2009, 12:31 PM
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

0
Shinu
Top achievements
Rank 2
answered on 15 Apr 2009, 05:10 AM
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
Tags
Grid
Asked by
Edward
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Edward
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or