title: Get data from the row of a Dropdown in a Gridview
body: <p>I have a Gridview with a column that has a DropDownList.
  I've binded this Dropdownlist with an event on the "SelectedIndexChanged".
  The problem is i can't get the value of a label of another column in the same row.</p>
  
  <p>The code is the next:</p>
  
  <pre><code>protected void grid_OnSelectedIndexChanged(object sender, EventArgs e)
      {
          grdCredenciales.DataBind();
  
          var dropdown = (DropDownList)sender;
          var row = (GridViewRow)dropdown.NamingContainer;
          var label = (Label)row.FindControl("lblMatricula");
  
          var value = label.Text; // I get "" in this line.
      }
  </code></pre>
  
  <p>And in the grid i have:</p>
  
  <pre><code>&lt;asp:ObjectDataSource ID="CredencialesDS" runat="server" /&gt;
  &lt;asp:GridView ID="grdCredenciales" runat="server" BackColor="White" DataSourceID="CredencialesDS"
      CssClass="DDGridView" RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6" AllowSorting="True"
      AllowPaging="True" AutoGenerateColumns="False" PageSize="10" OnRowDataBound="grdCredenciales_OnRowDataBound"&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField&gt;
              &lt;HeaderTemplate&gt;
                 &lt;asp:Label ID="Label7" ToolTip="Matrícula" runat="server" Text="Matrícula"/&gt;
             &lt;/HeaderTemplate&gt;
              &lt;HeaderStyle HorizontalAlign="Left" Width="15%"/&gt;
              &lt;ItemStyle HorizontalAlign="Left" /&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="lblMatricula" runat="server"&gt;&lt;%# Eval("Matricula") %&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField&gt;
              &lt;HeaderTemplate&gt;
                 &lt;asp:Label ID="Label19" ToolTip="Estado" runat="server" Text="Estado" /&gt;
             &lt;/HeaderTemplate&gt;
              &lt;HeaderStyle HorizontalAlign="Left" Width="15%"/&gt;
              &lt;ItemStyle HorizontalAlign="Left" /&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:DropDownList runat="server" ID="dpEstadoCredencial" AutoPostBack="True" OnSelectedIndexChanged="grid_OnSelectedIndexChanged" CssClass="comboEstado"/&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>I don't know why, but label.text returns an empty string. As you can see, i am calling the DataBind before, so the label should have a value at this point.</p>
  
  <p>Do you know how can i get the value i need from the label in another column?</p>
  
  <p>Thanks for everyone.</p>