5 Answers, 1 is accepted
0
Hello Naresh,
I suppose you mean to disable a control in Edit mode depending on the specific value.
Let me know if I missed something.
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I suppose you mean to disable a control in Edit mode depending on the specific value.
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
Hashtable table = new Hashtable(); |
GridEditFormItem item = e.Item as GridEditFormItem; //GridDataItem for InPlace |
if (item != null && item.IsInEditMode) |
{ |
item.ExtractValues(table); |
string value = table["yourColumnName"].ToString(); |
if (value == "Beverages") |
(item["yourColumnName"].Controls[0] as TextBox).ReadOnly = true; |
} |
} |
Let me know if I missed something.
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Naresh
Top achievements
Rank 1
answered on 21 Nov 2008, 08:03 AM
hello,
Dim item As GridEditFormItem = TryCast(e.Item, GridEditFormItem)
e.item is GridDataItem
item is nothing
Dim item As GridEditFormItem = TryCast(e.Item, GridEditFormItem)
e.item is GridDataItem
item is nothing
0
Accepted
Hello Naresh,
If the EditMode property is set to InPlace the item will be GridDataItem.
Otherwise if EditForms mode is used the item will be GridEditFormItem
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
If the EditMode property is set to InPlace the item will be GridDataItem.
<MasterTableView EditMode="InPlace"... |
Otherwise if EditForms mode is used the item will be GridEditFormItem
<MasterTableView EditMode="EditForms"... |
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) |
Dim table As New Hashtable() |
Dim item As GridEditFormItem = TryCast(e.Item, GridEditFormItem) |
'GridDataItem for InPlace |
If item <> Nothing AndAlso item.IsInEditMode Then |
item.ExtractValues(table) |
Dim value As String = table("yourColumnName").ToString() |
If value = "Beverages" Then |
(TryCast(item("yourColumnName").Controls(0), TextBox)).[ReadOnly] = True |
End If |
End If |
End Sub |
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Naresh
Top achievements
Rank 1
answered on 21 Nov 2008, 10:49 AM
i don't know why i couldn't see that simple mistake :D
but thanks, this is the solution to my problem.
but thanks, this is the solution to my problem.
0
Shinu
Top achievements
Rank 2
answered on 21 Nov 2008, 11:43 AM
Hi Naresh,
You can also go through the following help articles to get more details about editmodes in RadGrid.
In place
Edit forms
Shinu.
You can also go through the following help articles to get more details about editmodes in RadGrid.
In place
Edit forms
Shinu.