I use SQLDataSources all the time to drive various controls such as
Gridviews. But now I'm trying to pick data out of one using c#
code-behind.
There is no items collection. So far I can't figure out how to get at the
data.
Anyone know?
Thanks,
T
The DataSource controls in ASP.NET 2 are designed purely for
populating visual databound controls.They were never intended as a
means of accessing data programatically which is why there are no
public properties or methods that enable it.
The alternative are typed DataSets that are added to the App_Code
folder. Within these objects you can define TableAdapters using the
Visual Studio wizards that configure them. TableAdapters have the
functionality required for retrieving data from the database directly
or for filling typed DataSet tables. They also support insert, delete
and update operations as well as the use of stored procedures.
Essentially, DataSource and typed DataSets are the successors to
DataAdapters that were used for both purposes in version 1 of ASP.NET
HTH
You can use dataReader, Entity Framework, DataSets, LINQ to sql and so on.