I have a data set with about 15 columns, and I also have an ASP.net gridview. I was wondering if any one knew how I can populate the gridview with the dataset, but the issue is I just want a few of the columns from the dataset.
at the moment I’m just doing
GridView1.DataSource = ds;
GridView1.DataBind();
but this obviously binds all the columns from the dataset to the gridview.
So you are looking to create columns at runtime? Try this:
http://www.codeproject.com/KB/aspnet/dynamic_Columns_in_Grid.aspx
Alternatively, you can configure your gridview ahead of time in the aspx:
And make sure you set AutoGenerateColumns to false.