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

readonly column in editmode

1 Answer 20 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alyssa
Top achievements
Rank 1
Alyssa asked on 22 Nov 2013, 01:55 PM
Hi
Is it possible to show a readonly column in editmode. It should not be editable bt i want to view its value. Help me on this.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Nov 2013, 02:00 PM
Hi Alyssa,

Its not possible to have a ReadOnly column in EditMode. You can disable the column in editmode so as to see its value and not edit it. Please try the following code snippet.

ASPX:
<telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" UniqueName="ShipCity" />

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
 {
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
      (e.Item as GridEditableItem)["ShipCity"].Enabled = false;
    }
 }

Thanks,
Shinu
Tags
Grid
Asked by
Alyssa
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or