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

Display read only fields on edit form

2 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Najid Hanif
Top achievements
Rank 2
Najid Hanif asked on 23 Sep 2011, 03:13 AM
How can I make it so the fields I have set as read only display on the edit form (popup)? The way it is now they are invisible, I'd like them to still be displayed on the form but read only, or disabled.

Thanks

2 Answers, 1 is accepted

Sort by
0
Bill
Top achievements
Rank 1
answered on 23 Sep 2011, 03:16 AM
Have you tried to do the add attributes method, to set the visibility and properties of the controls?
0
Accepted
Shinu
Top achievements
Rank 1
answered on 23 Sep 2011, 05:17 AM
Hello Najid Hanif

You can try the following approach to make the Textbox disable.
C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
 {
       if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
       {
           GridEditFormItem edititem = (GridEditFormItem)e.Item;
           TextBox txt = edititem["OrderID"].Controls[0] as TextBox;
           txt.Enabled = false;
       }
 }

Thanks,
Shinu.
Tags
Grid
Asked by
Najid Hanif
Top achievements
Rank 2
Answers by
Bill
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Share this question
or