Best way to do this is to create your own datatype class. I used a GridView Control and used this method to get the 'Name' property value if you are using anonymous type.
void Gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string Name = (string)DataBinder.Eval(e.Row.DataItem, "Name");
}
}
Please refer this
link[
^] for other approaches like using reflection.