Problem with Dataset value persistance across postbacks

K

Kiran

Hi,

This is something weird I noticed recently in ASP.Net.

I have created typed dataset and I have filled the data.

when a postback happens, the data of the dataset is lost. Is there a workaround for this.

I have a databound listbox. When a postback happens the values in the listbox are still there.

I would like to know how and why this is happenning and also it's different for a dataset and a listbox.

Any help would be appreciated

Thanks
Kiran
 
K

Kiran

Thanks a lot
Kiran,

Between postbacks a web page doesn't exist anywhere. Every postback builds it up again and again. If you want page members to persist, you have to take care about it. Some members persist because they arrive back from the client with every postback. Your ddl is one of them. The dataset doesn't travel to client and back, although you can make it to in the ViewState. More appropriate persistance mechanism for a dataset is either re-populating it on every postback or saving it in a session variable.

Eliyahu

Hi,

This is something weird I noticed recently in ASP.Net.

I have created typed dataset and I have filled the data.

when a postback happens, the data of the dataset is lost. Is there a workaround for this.

I have a databound listbox. When a postback happens the values in the listbox are still there.

I would like to know how and why this is happenning and also it's different for a dataset and a listbox.

Any help would be appreciated

Thanks
Kiran
 
E

Eliyahu Goldin

Kiran,

Between postbacks a web page doesn't exist anywhere. Every postback builds it up again and again. If you want page members to persist, you have to take care about it. Some members persist because they arrive back from the client with every postback. Your ddl is one of them. The dataset doesn't travel to client and back, although you can make it to in the ViewState. More appropriate persistance mechanism for a dataset is either re-populating it on every postback or saving it in a session variable.

Eliyahu

Hi,

This is something weird I noticed recently in ASP.Net.

I have created typed dataset and I have filled the data.

when a postback happens, the data of the dataset is lost. Is there a workaround for this.

I have a databound listbox. When a postback happens the values in the listbox are still there.

I would like to know how and why this is happenning and also it's different for a dataset and a listbox.

Any help would be appreciated

Thanks
Kiran
 

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,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top