title: GridView SelectedIndexChanging event, find text in TemplateField
body: <p>i have grid and it's selectIndexchanging event.</p>
  
  <p>my aspx code:</p>
  
  <pre><code> &lt;asp:GridView ID="gvClients" runat="server" AutoGenerateColumns="False" BackColor="LightGoldenrodYellow"
                 BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None"
      OnRowEditing="gvClients_RowEditing"  Font-Size="Medium" 
      onrowcancelingedit="gvClients_RowCancelingEdit" 
      onrowdeleting="gvClients_RowDeleting" onrowupdating="gvClients_RowUpdating" 
      onselectedindexchanging="gvClients_SelectedIndexChanging"&gt;
      &lt;FooterStyle BackColor="Tan" /&gt;
      &lt;Columns&gt;
          &lt;asp:CommandField ShowEditButton="True" ButtonType="Image" CancelImageUrl="~/Images/Cancel.png"
              UpdateImageUrl="~/Images/save.png" EditImageUrl="~/images/Edit.png" ItemStyle-Width="25px"
              UpdateText="Update" CancelText="Cancel" /&gt;
          &lt;asp:CommandField ShowDeleteButton="true" DeleteImageUrl="~/Images/delete.png" ButtonType="Image"
              ItemStyle-Width="25px" /&gt;
          &lt;asp:TemplateField&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:ImageButton runat="server" ID="imgSelect" CommandName="Select" AlternateText="Select"
                      ImageUrl="~/Images/allowed.png" /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="ClientId" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left"&gt;
              &lt;ItemTemplate&gt;
                  &lt;%# Eval("ClientId")%&gt;
              &lt;/ItemTemplate&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox runat="server" ID="txtClientClientId" Text='&lt;%#Eval("ClientId") %&gt;' /&gt;
              &lt;/EditItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="ClientName" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left"&gt;
              &lt;ItemTemplate&gt;
                  &lt;%# Eval("ClientName")%&gt;
              &lt;/ItemTemplate&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox runat="server" ID="txtClientClientName" Text='&lt;%#Eval("ClientName") %&gt;' /&gt;
              &lt;/EditItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Status" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left"&gt;
              &lt;ItemTemplate&gt;
                  &lt;%# Eval("Active")%&gt;
              &lt;/ItemTemplate&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox runat="server" ID="txtClientActive" Text='&lt;%#Eval("Active") %&gt;' /&gt;
              &lt;/EditItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
      &lt;PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" /&gt;
      &lt;SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" /&gt;
      &lt;HeaderStyle BackColor="Tan" Font-Bold="True" HorizontalAlign="Left" Font-Size="Smaller" /&gt;
      &lt;AlternatingRowStyle BackColor="PaleGoldenrod" /&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>now, my <code>SelectedIndexChanging</code> code:</p>
  
  <pre><code>protected void gvClients_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
  {
      GridViewRow row = gvClients.Rows[e.NewSelectedIndex];
      txtClientNumber.Text = row.Cells[3].Text;
  }
  </code></pre>
  
  <p>issue is, text coming null . there is data but instead of value it's coming null....also same code is working on another page. so, kindly let me know. what wrong i did?</p>
  
  <p>thanks</p>