title: ViewState asking for instance of object
body: <p>I am trying to a viewdate in code as can be seen below and i am getting the error message below, any ideas why this would be happening. </p>
  
  <p>Code being used</p>
  
  <pre><code>var state = ViewState["GridViewIndex"].ToSting()
  </code></pre>
  
  <p>Error Message</p>
  
  <p><strong>Object reference not set to an instance of an object.</strong></p>