Where is bound data stored?

R

rbourgeois

Hi,

I am trying to find out where a bound dataset is being stored. I am
fairly new to all this so let me try to explain with an example using
my code:

if( !IsPostBack)
{
grdMyDataGrid.DataSource = GetData();
grdMyDataGrid.DataBind();
}

Since my data persists every time I do a postback, it must be stored
somewhere. Is it stored in my ViewState? In the Session? Some other
mechanism?

Thanks in advance.
 
T

Teemu Keiski

Hi,

the DataSet itself isn't stored as is, but your grid control is able to
store relevant data in ViewState so that it can reconstruct itself on
postback. E.g the data it gets when databinding.
 
G

Guest

I know this isn't an answer, but I have got a problem I think is related to
this question. I've got data in a tbl in sql that gets deleted and
repopulated constantly, when I populate this data into a gridview and I
refresh the page, the gridview keeps adding the data sequentially instead of
displaying the actual data in the table...this is with SQL 2000 and ASP.NET
on .NET 2.0
 
G

GroupReader

The data is stored in viewstate, which, by the way, can cause your web
pages to become outrageously bloated when used with a grid.

After rendering your page, select 'view source' from the browser.
Search for the hidden text field called "_VIEWSTATE". All that encoded
data after the = sign is your grid data being persisted between
postbacks. When you submit your form, all that data goes back to the
server from the client so that asp.net can rebuild your grid. It makes
life simple at first for a developer and seems really cool at first...
but after a while, you realize that this is just "wrong" and you'll
figure out ways to get your grid to continue working even after setting
"enableviewstate=false". If you begin to have performance problems,
this is one of the first places to look.
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top