title: Cannot store an object in a webcontrol when another webcontrol is executed
body: <p>I'm using two web controls. Web control A includes webcontrol B. When webcontrol A is called, it automatically calls webcontrolB. WebcontrolB passes a value to the method Modify() of webcontrolA. I would like to store an object, and I do it using viewstate:</p>
  
  <pre><code> protected void Page_Load(object sender, EventArgs e)
      {
          if (IsPostBack)
          {
              object o = Object;
              ViewState["o"] = o;
  
          }
      }
  </code></pre>
  
  <p>The problem is that when I return back to webcontrolA the object that I retrieve from ViewState is null. So the object is not stored when another webcontrol is executed. Ho can I store it?? I tried also Session but it gaves me the following error: "Error Message: Object reference not set to an instance of an object"</p>
  
  <p>to retrieve the value from viewstate I used this:</p>
  
  <pre><code>public void Modify(int i)
  {    
     object o = (object)ViewState["o"];  //result is null :(
  }
  </code></pre>