Do I have to use ViewState?

R

rockdale

I have a page that doing editing for 2 things, add/edit a group and
then populate the member list for this group.

the member list is a user control that can add new member in or edit
existing member info.

Currently, whenever the user click a delete/save button, I will
postbace and write the changes back to database and then refresh the
memberlist using the data retrieved from database.

As I review this code now, I think the member list hit database too
much, everytime user add/remove/change the member, I need to do a trip
(update and retrieve) to database.

I am thinking of save the changes to database only when the user click
the save button outside member list. That is save member list changes
and group info changes only when the user click the outside save
button.

So I need to store the member list changes in somewhere and persist
between multiple postback of this page. the member list data source is
dataset (I can change to ObjectDataSource if needed), everytime user
click save/delete button inside this member list, I will remove/add /
change my dataset.
And finally, when they want to save group info and member list , I
will loop through this dataset and write back to database.


To persist the dataset between these page postback, I am thinking
using viewstate, is this a right way to do it, ot is there a "hidden
automatic way " that asp.net done that for me already?

sorry for the long post and thanks in advance
-rockdale
 
D

darrel

To persist the dataset between these page postback, I am thinking
using viewstate, is this a right way to do it, ot is there a "hidden
automatic way " that asp.net done that for me already?

The viewstate is written directly to the page's source code. I wouldn't
store a dataset in there, as you'd quickly be creating 1mb+ web pages if
you're not careful.

I'd rather take another DB hit on the server end than to force the end-user
to take a huge HTML file size hit/download.

-Darrel
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top