Can a datareader be stored in a viewstate?
What data can be stored in viewstate?
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.
Any data [serializable] that you need to access during postbacks can be stored in a ViewState.
A DataReader cannot be serialised because is is based on Connected model. So it can’t be stored in ViewState.
Also storing huge datatables in ViewState is not advisable. Return only necessary data that you need to show in the current context.