title: how can i get the value of hidden field in grid view?
body: <p>the order number of hidden field in grid view is 7. </p>
  
  <p>when i click the button the line </p>
  
  <pre><code>string sValue = ((HiddenField)GridView1.SelectedRow.Cells[7].FindControl("HiddenField1")).Value; 
  </code></pre>
  
  <p>gives error which is "Object reference not set to an instance of an object."</p>
  
  <pre><code>          &lt;asp:TemplateField&gt;
              &lt;ItemTemplate&gt; 
  
                  &lt;asp:HiddenField ID="HiddenField1" runat="server" 
                      Value='&lt;%#Eval("RSS_ID")%&gt;'/&gt;
  
              &lt;/ItemTemplate&gt;
            &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>c# side</p>
  
  <pre><code>else if (e.CommandName == "View")
  {
      string sValue = ((HiddenField)GridView1.SelectedRow.Cells[7].FindControl("HiddenField1")).Value;                   
  }
  </code></pre>