how can i get the dataset from a gridview i have populated?
i tried this:
Dim importedDS As DataSet = gwResults.DataSource
but it’s coming out blank all the time. is there another way?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Find another way to store/retrieve/cache the dataset, or the specific values you need from it.
When you first retrieve a dataset and assign it to a Grid, you will be able to access it for the remainder of the page request. As soon as the page request is over, the HTTP context and page and any associated objects are purged, they will be set for garbage collection and destroyed. (As far as we’re concerned, anyway)
On the next post back, the grid will reload it’s values from the form, (and some properties from view state), but not the whole dataset, since that was never stored in the form/view state. Keeping a dataset in view state would be a incredibly inefficient. This is why the DataSource property will be blank on subsequent post backs.