.Net GridView not displaying all columns in dataset
Posted on 2011-04-23
I have a dataset that has two or more columns depending on the user's query. I am binding the dataset to a GridView, and showing the user the results.
The dataset contains all of the columns/rows that I need when I view the dataset in the Visual Studio debugger. However, when I bind it to a GridView, and it renders to the browser, two of the columns are missing.
I have the GridView set to Auto-generate fields, and the first two columns display, but for some reason the last two columns do not appear. I can create a Template Field, bind the field to the name of the column in the dataset, and it appears perfectly! However, this is not a viable solution because the dataset is going to have different column names depending on the query.