473,396 Members | 1,895 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,396 software developers and data experts.

Do I have to use ViewState?

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

Nov 9 '07 #1
1 803
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
Nov 9 '07 #2

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

Similar topics

10
by: neo | last post by:
hi, I am studying ASP.NET and have few questions - 1) The session ID and values of controls is stored in VIEWSTATE variable. So now when we put EnableViewState="false" in Page directive and...
0
by: S.Sigal | last post by:
Hello: I've been trying to 'organize' the layout of my larger controls by moving variables into instances of subclasses...but it just dawned on me that I might be opening a real can of worms due...
2
by: epigram | last post by:
I'm responding to a button click event on an asp.net web form. I then need to retrieve the value from a TextBox control and I want to compare it against the control's previous value to see if it...
6
by: mosscliffe | last post by:
I am testing for how/when a page is posted back and I decided to use a ViewState variable in PageLoad to set up a counter, but it appears, the ViewState is cleared on each PageLoad. So then I used...
12
by: Nick C | last post by:
Hi How can i reduce the viewstate for my asp.net application. It is getting very large now. What is a good solution? thanks N
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.