ViewState is always null on Postback
-
Hi I am really scratching my headache around on this one! At the moment I am undertaking a Proof of Concept project, and on a page I am loading an Xml Document, this xml document needs to be saved into a viewstate so, I have written aftering loading up the xml document: this.ViewState["tempDoc"] = xmlDoc; The load of the xml document happens by the user clicking a button. Now, I am not getting any errors at this stage. On the next page I have used: protected override void LoadViewState(object savedState) { base.LoadViewState(savedState); } The problem being is that on this page I have no ViewState data! Even just calling the ViewState on the same page where I set it gives me the same problem. I have even tried setting simple data types like numbers and I am getting the same problem. What is going on???!!! The funny thing is though, I am not getting the problem with Session, but for this project, I can't use Session. Any ideas?????????????
-
Hi I am really scratching my headache around on this one! At the moment I am undertaking a Proof of Concept project, and on a page I am loading an Xml Document, this xml document needs to be saved into a viewstate so, I have written aftering loading up the xml document: this.ViewState["tempDoc"] = xmlDoc; The load of the xml document happens by the user clicking a button. Now, I am not getting any errors at this stage. On the next page I have used: protected override void LoadViewState(object savedState) { base.LoadViewState(savedState); } The problem being is that on this page I have no ViewState data! Even just calling the ViewState on the same page where I set it gives me the same problem. I have even tried setting simple data types like numbers and I am getting the same problem. What is going on???!!! The funny thing is though, I am not getting the problem with Session, but for this project, I can't use Session. Any ideas?????????????
Hi Andy, I believe scope of ViewState is only on page level. Therefore in other page it would not available. On same page it should be work. Go through for deep concept: http://msdn.microsoft.com/en-us/library/ms972976.aspx#viewstate_topic10[^] Thanks
Parwej Ahamad ahamad.parwej@gmail.com
-
Hi Andy, I believe scope of ViewState is only on page level. Therefore in other page it would not available. On same page it should be work. Go through for deep concept: http://msdn.microsoft.com/en-us/library/ms972976.aspx#viewstate_topic10[^] Thanks
Parwej Ahamad ahamad.parwej@gmail.com
-
Hi I am really scratching my headache around on this one! At the moment I am undertaking a Proof of Concept project, and on a page I am loading an Xml Document, this xml document needs to be saved into a viewstate so, I have written aftering loading up the xml document: this.ViewState["tempDoc"] = xmlDoc; The load of the xml document happens by the user clicking a button. Now, I am not getting any errors at this stage. On the next page I have used: protected override void LoadViewState(object savedState) { base.LoadViewState(savedState); } The problem being is that on this page I have no ViewState data! Even just calling the ViewState on the same page where I set it gives me the same problem. I have even tried setting simple data types like numbers and I am getting the same problem. What is going on???!!! The funny thing is though, I am not getting the problem with Session, but for this project, I can't use Session. Any ideas?????????????
Obviously you need to ensure ViewState is enable at the page level, but also make sure it hasn't been explicitly disabled in the web.config, or the machine.config.
I know the language. I've read a book. - _Madmatt
-
Hi I have tried it on the same page, but still got the same problem. My little test was on button click to set the ViewState but redirect to the same page. So, I am very unclear on how to solve this one!!! I really do need some help!!!
viewstate available only in same page and on post back means when you click any button then it's data will be available but if you will redirect to same page or another page on click of button no viewstate data will be available.
You get the best out of others when you give the best of yourself.