Weste Posted April 7, 2006 Posted April 7, 2006 I am binding a data grid control to an array list that was populated via a data reader. The code is below while (dataReader.Read()) { Company company = new Company(dataReader.GetString(0), dataReader.GetString(1), dataReader.GetString(2)); companies.Add(company); } } this.dgTest.DataSource = companies; This first item in the data reader is the CompanyID, 2nd is CompanyName, and 3rd is ContactName. When the data is displayed in the data grid the columns are reversed - ie the 1st column is ContactName, 2nd column is CompanyName, and 3rd is CompanyID. How do I populate the data grid so the columns are in the same order as the data reader? Thanks. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.