I have three columns (EventID, EventName, DateCreated) in a RadGrid which I've attached some Manual CRUD operations to. EventID and DateCreated are created automatically in SQL and never need to be updated, so I have hidden their text boxes in the Add Form and disabled them in the Edit Form. My problem is: in the Add Form, their labels stay visible.
How can I hide those labels? I have attached a picture, and code for hiding/disabling text boxes are below.
How can I hide those labels? I have attached a picture, and code for hiding/disabling text boxes are below.
protected
void
RadGrid1_ItemCreated(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item = e.Item
as
GridEditableItem;
GridEditManager manager = item.EditManager;
GridTextBoxColumnEditor editor = manager.GetColumnEditor(
"EventID"
)
as
GridTextBoxColumnEditor;
GridTextBoxColumnEditor editor2 = manager.GetColumnEditor(
"DateCreated"
)
as
GridTextBoxColumnEditor;
if
(!(e.Item
is
GridEditFormInsertItem))
//edit record
{
editor.TextBoxControl.Enabled =
false
;
editor2.TextBoxControl.Enabled =
false
;
}
else
//add record
{
editor.TextBoxControl.Visible =
false
;
editor2.TextBoxControl.Visible =
false
;
}
}
}