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

[Solved] Accessing readonly field in edit mode

1 Answer 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Milan Gurung
Top achievements
Rank 1
Milan Gurung asked on 24 Jul 2009, 03:06 PM
Hi,

Is there a way out so that I can access the readonly column during editmode in ItemDataBound Event..? It is returning   all the time.


If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
            Dim editItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
,..............................
end if

Thanks a lot.

Milan G

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 24 Jul 2009, 05:00 PM
Hello Milan,

Try one of the following snippets:
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs) 
    If e.Item.IsInEditMode Then 
        Dim test As String = DataBinder.Eval(e.Item.DataItem, "CustomerName").ToString() 
    End If 
End Sub 

or:
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs) 
    If e.Item.IsInEditMode Then 
        Dim table As New Hashtable() 
        (TryCast(e.Item, GridEditableItem)).ExtractValues(table) 
        Dim test As String = table("CustomerName").ToString() 
    End If 
End Sub 

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Milan Gurung
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or