title: ASP.NET GridView_RowEditing get value of cell
body: <p>This is pretty basic stuff, but I am unable to extract the text from a cell in my gridview.</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Rolle" SortExpression="role"&gt;
      &lt;ItemTemplate&gt;
          &lt;asp:Label ID="roleLabel" runat="server" Text='&lt;%# Eval("role") %&gt;'&gt;&lt;/asp:Label&gt;
      &lt;/ItemTemplate&gt;
  
      &lt;EditItemTemplate&gt;
          &lt;asp:DropDownList style="width: 200px;" ID="roleDropdown" runat="server" DataSourceID="SqlDataSourceDropDownlist" DataTextField="role" DataValueField="roleID"&gt;&lt;/asp:DropDownList&gt;
       &lt;/EditItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p> </p>
  
  <pre><code>Protected Sub GridView1_rowediting(sender As Object, e As GridViewEditEventArgs) Handles GridView1.RowEditing
  
      Dim tb As Label
      tb = CType(GridView1.SelectedRow.Cells(1).FindControl("roleLabel"), Label)
      Dim userRoleString As String = tb.Text
  
  End Sub
  </code></pre>
  
  <p>I received this error:</p>
  
  <pre><code>Object reference not set to an instance of an object.
  </code></pre>
  
  <p>How do i extract the text from the cell in a GridView?</p>