I would like to fetch the column names from List. As I have a class
public class DetailView
{
public string SiteName { get; set; }
public string ItemType { get; set; }
public string AssetStorage { get; set; }
}
and in some method in controller am filling the data into Session. Now I want to get the column names for some reason. Am putting my session data into that list.
List<DetailView> objgrdDtls = new List<DetailView>();
objgrdDtls = (List<DetailView>)Session["datasetVal"];
I would like to have the Column name. Pleas note by doing the below code i got the value of that particular column name. restult1 has the column value.
var result1 = objgrdDtls.Where(p => p.SiteName.ToLower().Contains(txt1));
But all i need is Column name. So how do i get that.
stringColumnname = objgrdDtls.get(columnaname => some filter)?
Is this is the way how to get column names? Not sure how to get the column name one by one? Thanks.