Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Binding to dynamic type with ObjectDataSource

$
0
0

Hello,

I have an object data source pointing at a of List<DynamicJsonObject>. The problem is that the report throws an error when I reference a field name because it doesn't think the field exists. So, if I create a textbox and do "=Fields.LocationName", it gets an error when I preview it. However, this code works:

private void detail_ItemDataBound(object sender, EventArgs e)
        {
            var detail = (Telerik.Reporting.Processing.DetailSection)sender;
            Telerik.Reporting.Processing.TextBox txt = (Telerik.Reporting.Processing.TextBox)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(detail, "txtLocationName");
            var data = (dynamic)detail.DataObject.RawData;
            txt.Value = data.LocationName;
        }

 

This is presumably working because I can cast the raw data as dynamic. 

I'm not wedded to this way of doing this, but I do need a way to report on json data. Is this possible?

Thanks.

 


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>