title: Cannot retrieve value on rowdeleting in GridView
body: <p>I  have a problem for retrieving values for deleting records.
  I'm using OnRowDeleting in a gridview with templatefields, and I can't retrive record selected value for deleting, this is my grid:</p>
  
  <pre><code>&lt;asp:GridView ID="gvw_Cli_Emp_EmpData" runat="server" AutoGenerateColumns="false"
          CssClass="mGrid" PagerStyle-CssClass="pgr" Width="50%" AutoGenerateDeleteButton="True" 
          AlternatingRowStyle-CssClass="alt" Font-Size="Small" OnRowDeleting="Borrando"&gt;
          &lt;Columns&gt;
              &lt;asp:TemplateField&gt;
                  &lt;ItemTemplate&gt;
                      &lt;a href="#" onclick="window.open('Clientes_Empleados_Detalle.aspx?cliCod= &lt;%#Eval("ClienteCodigo1").ToString() 
                          + "&amp;EmpNom=" + Eval("Empleado1").ToString()
                          + "&amp;EmpCod=" + Eval("IdCliEmp").ToString()
                          + "&amp;idDepart=" + Eval("IdDepartamento").ToString()
                          + "&amp;Depart=" + Eval("Departamento1").ToString()
                          + "&amp;EmpNiv=" + Eval("NivelAcceso1").ToString()    
                          %&gt; ','PrintMe','height=500px,width=800px,scrollbars=1');"&gt;Editar&lt;/a&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
               &lt;asp:TemplateField HeaderText="CLIENTE"&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="lbl_CliEmp_CliCod" runat="server" Text='&lt;%# Eval("ClienteCodigo1") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
              &lt;asp:TemplateField HeaderText="CODIGO"&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="lbl_CliEmp_EmpId" runat="server" Text='&lt;%# Eval("IdCliEmp") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
              &lt;asp:TemplateField HeaderText="EMPLEADO"&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="lbl_CliEmp_EmpNom" runat="server" Text='&lt;%# Eval("Empleado1") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
              &lt;asp:TemplateField HeaderText="ID DEP"&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="lbl_CliEmp_DepId" runat="server" Text='&lt;%# Eval("IdDepartamento") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
              &lt;asp:TemplateField HeaderText="DEPARTAMENTO"&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="lbl_CliEmp_EmpDep" runat="server" Text='&lt;%# Eval("Departamento1") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
              &lt;asp:TemplateField HeaderText="NIVEL"&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="lbl_CliEmp_EmpNiv" runat="server" Text='&lt;%# Eval("NivelAcceso1") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
  
          &lt;/Columns&gt;
      &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>And for delete:</p>
  
  <pre><code>protected void Borrando(object sender, GridViewDeleteEventArgs e)
  {
      string cell = gvw_Cli_Emp_EmpData.Rows[e.RowIndex].Cells[0].Text; //this retuns me ""
      int EmpCliCod = Convert.ToInt32(cell);
  
      DialogResult dialogResult = MessageBox.Show(new Form { TopMost = true }, "Delete?", "Confirma", MessageBoxButtons.YesNo);
      if (dialogResult == DialogResult.Yes)
      {
          cliEmpBL.clientesEmpleados_SupEmpleado(EmpCliCod); //here execute deletion record from my datalayer 
          Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "alert('Deleted!');", true);
      }
      else if (dialogResult == DialogResult.No)
      { }
  }
  </code></pre>
  
  <p>So, as you can see returns me "".
  I have tried resolve this, using:</p>
  
  <pre><code>        System.Windows.Forms.Label EmpId = e.Item.FindControl("lbl_CliEmp_CliCod") as System.Windows.Forms.Label;
      string val = EmpId.Text;
  </code></pre>
  
  <p>But same result, any idea?
  please, I hope anyone can help me.</p>
  
  <p>best regards</p>