Last post Nov 29, 2008 08:31 AM by sandeepreddi
Nov 29, 2008 07:10 AM|DimAlexAsVarChar|LINK
I'm only few weeks into Visual Studio 2008 Express, on that painful curve of self development.
I am able to read a single column of data from SQL 2008 express.That I am able to do, using SQL syntax, Linq or Table adaptor.I have 144 values of mixed text and numbers as my source data.
In playing around a while ago, I am sure I found two setting somewhere in the properties of a GridView that allowed me set the number of columns and rows that the list of data would fill. I would like to have all 144 values on screen at once so I am avoiding
I wish the data to display as
and not as
I've spent a couple of hours looking for it, and research on the net tells me data retrieved from SQL or ObjectDataSources can be differently presented through the GridView, and I've played with them all, but I still can't find those settings. I'm now in
Perhaps I've played too much, and I wasn't working with a GridView when I think I found the settings? Was it dependent on the data source?
Could you help?
asp.net 2.0 Gridview
Nov 29, 2008 08:24 AM|IamSrikanthReddy|LINK
Hi DimAlexAsVarChar ,
You can make use of the DataList Control instead of the GridView Control. Please look at the following aspx and the cs code for DataList. Make sure u specify the RepeatDirection as horizontal (the bolded and underlined part below)
and the cs code would be as follows:
DataList1.DataSource = dtEmployees;
Nov 29, 2008 08:28 AM|DimAlexAsVarChar|LINK
yes that was it! The DataList :)
Thanks for you reply,
Nov 29, 2008 08:31 AM|sandeepreddi|LINK
Try to use below code, It should show columns as rows in GridView
ds is dataset from Database
DataTable dt = new DataTable()
for(int i =0;i<ds.Tables.Columns.count;i++)
DataRow row = dt.NewRow();
row = ds.Tables.Columns[i].Name;
datagrid.DataSource = dt;