I'm using Telerik RadGrid's NeedDataSource event to bind to a anonymous type.
Now OnItemDataBound is used to bind a DropDownList inside RadGrid.
protected void rgQuotations_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
dynamic di = e.Item.DataItem;
DropDownList ddlStatus = (e.Item.FindControl("ddlStatus") as DropDownList);
if (di.Status == 4)
{
ddlQuoteStatus.Items.Add("4");
}
}
}
When it tries to get value of di.Status
it throws exception
An exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in System.Core.dll but was not handled in user code
Additional information: 'object' does not contain a definition for 'Status'
But I can clearly see the value by hover on it.
How can I get this value without getting error?