Click here to Skip to main content
15,919,879 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,

I am trying to study control state when i came across an article in code project
A Beginner's Tutorial - Understanding ControlState in ASP.NET[^]

But in that example only "Text" value is kept in control state, what if i have to keep both?
So i tried this code
C#
protected override void OnInit(EventArgs e)
      {
          Page.RegisterRequiresControlState(this);
          base.OnInit(e);
      }

      protected override object SaveControlState()
      {
          object[] state = new object[2]; // save the 2 properties
          state[0] = Text;
          state[1] = Text1;

          return state;
      }

      protected override void LoadControlState(object savedState)
      {
          object[] state = (object[])savedState;
          Text = (string)state[0];
          Text1 = (string)state[1];
      }


But it doesn't seem to work.. Can anyone please help me out ???

Thanks in advance


Arjun
Posted
Comments
Sunasara Imdadhusen 26-Dec-13 6:43am    
Please post your doubts at A Beginner's Tutorial - (http://www.codeproject.com/Articles/331981/A-Beginner-s-Tutorial-Understanding-ControlState-i) so you will be get answer from the author quickly

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900