Search code examples
c#asp.netdataview

How to get a value from a column in a DataView?


I have a dataview defined as:

DataView dvPricing = historicalPricing.GetAuctionData().DefaultView;

This is what I have tried, but it returns the name, not the value in the column:

dvPricing.ToTable().Columns["GrossPerPop"].ToString();

Solution

  • You need to specify the row for which you want to get the value. I would probably be more along the lines of table.Rows[index]["GrossPerPop"].ToString()