DataSets in ASP.NET 2.0

J

Jorge Bustos

Is there any way to drag & drop a DataSet or DataTable in a Web Form to link
it visually to a gridview, as it was done in ASP.NET 1.1? I can't fnd those
components in the toolbox, and I have tried to add them to it without
success.

I've been able to add a DataTable object as a member of the Web Form class,
and Bind it by using code (myGridView.DataSource = myDataTable,
myGridView.DataBind) But I don't have wizard support to configure the
columns, create the item templates and so on, so all that must be done
without help.

I now I can drop an ObjectDataSource to link directly to it, but, if I do
so, I can't modify the Dataset and keep it in Session to reuse it later.
What I'm trying to do is make several changes to the dataset (in several
postbacks), and when I decide everything it's right, update the changes in
the server. The ObjectDataSource forces me to post the changes to the DB
right when I make a single change in the gridview

If I want my GridView to allow me to do changes, and it's bound to an
ObjectDataSource, which it's in turn bound to my Business objects, it forces
me to implement methods for updating, inserting and deleting in my Business
Layer classes, so my only option is to post the changes to the database or
they're lost because I don't have access to the Page's Session object or any
other store which survives postbacks.

Am I missing something?

Thanks for your time.
 
B

Brock Allen

I now I can drop an ObjectDataSource to link directly to it, but, if I
do so, I can't modify the Dataset and keep it in Session to reuse it
later. What I'm trying to do is make several changes to the dataset
(in several postbacks), and when I decide everything it's right,
update the changes in the server. The ObjectDataSource forces me to
post the changes to the DB right when I make a single change in the
gridview

Change the code in the data access class to store the DataTable/DataSet in
Session (or in the cache).

-Brock
http://staff.develop.com/balle
 
J

Jorge Bustos

Thank you very much for your help, but this doesn't solve my problem. I
think I'm missing something, but I can't find the way to access the Page's
Session object from my DAL or BLL clasess. How can I do it?

I've tried to instantiate my Business Layer Class in the web form, so that I
can keep it in Session, but then I can't connect the ObjectDataSource to
this objet.

I've also tried to create a DataSet/DataTable in the apge, but then again, I
can't connect the ObjectDataSource to it.

Finally I have had to instantiate my objects in the web form code behind,
use the ASP.NET 1.1 way of binding (assing to DataSource, and call
DataBind()) to be able to keep data objects in Session.
But when I do this by code I can't use VS wizards to configure databound
controls (like a gridview). And I have to create the templates, bindings and
so on manually.
In ASP.NET 1.1 I added the DataSets to my form as controls, so that I had
visual support for them. I can't believe it's no longer possible to do this.

If you could offer any further help I'd be very grateful. Even if you simply
confirm me that this is the way to do it now.

Jorge.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top