473,378 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Displaying the default fields from a DataSet, to the GridView

Hi
I'm binding a DataSet, using the ObjectDataSource control, to a GridView

I want the GridView to default to the columns returned in the DataSet,
without having to specifically name them.

How can I do this in code??

Thanks
Nov 29 '05 #1
2 1150
AutoGenerateColumns ="true" , e.g.
<asp:gridview ID="Gridview1" runat="server" DataSourceID="SqlDataSource1"
AutoGenerateColumns ="true" >
</asp:gridview>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [ProductName], [SupplierID], [CategoryID],
[UnitsInStock], [UnitPrice], [UnitsOnOrder] FROM [Alphabetical list of
products]">
</asp:SqlDataSource>
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Paul Aspinall" wrote:
Hi
I'm binding a DataSet, using the ObjectDataSource control, to a GridView

I want the GridView to default to the columns returned in the DataSet,
without having to specifically name them.

How can I do this in code??

Thanks

Nov 29 '05 #2
Hi Philip,

Thanks for the reply.
Yes - thats what I was looking for. I actually found it about 5 minutes
after making the post, but my news server hadn't replicated my post, so I
couldn't inform everyone.

Thanks anyway!

Paul

"Phillip Williams" <Ph**************@webswapp.com> wrote in message
news:F2**********************************@microsof t.com...
AutoGenerateColumns ="true" , e.g.
<asp:gridview ID="Gridview1" runat="server" DataSourceID="SqlDataSource1"
AutoGenerateColumns ="true" >
</asp:gridview>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [ProductName], [SupplierID], [CategoryID],
[UnitsInStock], [UnitPrice], [UnitsOnOrder] FROM [Alphabetical list of
products]">
</asp:SqlDataSource>
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Paul Aspinall" wrote:
Hi
I'm binding a DataSet, using the ObjectDataSource control, to a GridView

I want the GridView to default to the columns returned in the DataSet,
without having to specifically name them.

How can I do this in code??

Thanks

Nov 29 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Charles Astwood | last post by:
Hi, just starting out working my way round C Sharp and aspx. Used to write all my sites in asp and just need a few pointers in how to display data. I have made a connection to my SQL2000...
1
by: Jon S via DotNetMonster.com | last post by:
HI all, I'm returning a dataset to a gridview control. When the gridview asp.net control is populated from the returning dataset some of the cells remain empty. This is expected as some data...
3
by: William LaMartin | last post by:
I have a gridview (with no properties set) on an aspx page which I populate from an XML file with the code below. The data in the XML file looks like this <description>National Trust for...
8
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to...
7
by: =?Utf-8?B?SmVmZiBCZWVt?= | last post by:
The default paging behavior of the gridview doesn't work well with very large sets of data which means we have to implement some sort of custom paging. The examples I have seen (4guysfromrolla,...
51
by: kjewell23 | last post by:
Hello, I'm new to this asp.net 2.0 I need help?? My database is coming from AS400 which uses odbc Commands. i have data in the dataset but nothing showing in my gridview. However the data does show...
1
by: Dave | last post by:
I'm having problems getting the GridView to reliably display a large amount of data (50,000+ rows). I am working my way through the excellent book “Real World ASP.NET Best Practices” by Farhan...
1
by: readnlearn | last post by:
Hii, in my table I have fields like id1,title,description,category,posteddate..In my gridview I wish to display title,posteddate and category. I placed a hyperlink for title field. Now when I click...
3
by: anjali5 | last post by:
Hello Everyone, I want to display an image in my gridview. The only thing is my datatabse table is returning true if there is an image and false if there is no image and I am binding my...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.