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

[Solved] Accessing value in OnItemDataBound: "Item in insert mode does implement indexer only when the edit form is autogenerated"

1 Answer 406 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 06 Jul 2009, 02:57 AM
Attempting to use the code:
item["fieldname"] inside of an OnItemDataBound handler for my RadGrid results in the exception:
'Telerik.Web.UI.GridNotSupportedException'
    base {Telerik.Web.UI.GridException}: {"Item in insert mode does implement indexer only when the edit form is autogenerated"}'

Is there some other way to get to the data values in the OnItemDataBound, or some reasonable way to make this exception go away?  My RadGrid is backed by a List of custom objects, which are mapped via telerik:GridBoundColumn.  Autogenerating isn't an option, I need to use a form template for my client.

I tried searching the forums, but didn't find anything that explained this error.

1 Answer, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 06 Jul 2009, 03:29 AM
Somehow I missed the obvious workaround but a friend just sorted me out:
Item.DataItem, cast to the item type you are using.

Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Share this question
or