protected void Page_Load(object sender, EventArgs e) { var path = Server.MapPath(@"~/Dealertrack-CSV-Example.csv"); var data = CSVHelperClass.Read <DealerTrack>(new CsvSource(path)).ToList(); gvDealerTrack.DataSource = data; gvDealerTrack.DataBind(); var item = data.GroupBy(x => x.Vehicle).OrderByDescending(i => i.Count()).First().Key; txtMostCarSell.Text = item; }
public CsvSource(CSVHelperClass csvFile) { this.TextReader = new StreamReader(csvFile.BaseStream); }