Anonymous type in Repeater DataBound event
anonymous-types, asp.net, c#, databound, repeater
Solution
You can use DataBinder.Eval:
string repName = (string)DataBinder.Eval(e.Item.DataItem, "RepName");
string target = (string)DataBinder.Eval(e.Item.DataItem, "Target");
Problem
I'm setting the DataSource of an ASP.NET repeater as follows: ``` rptTargets.DataSource = from t in DB.SalesTargets select new { t.Target, t.SalesRep.RepName }; ``` Now, in the repeater's OnDataBound event, how can I retrieve the RepName and Target properties from the anonymous type contained in e.Item.DataItem? Many Thanks