title: row.Cells[4].Text returns nothing in GridView1_SelectedIndexChanged?
body: <p>I have a GridView in my page :</p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AllowPaging="True" BackColor="White"
      AutoGenerateColumns="False" EmptyDataText="No data available." BorderColor="#DEDFDE"
      BorderStyle="None" BorderWidth="1px" CellPadding="4" Width="729px" ForeColor="Black"
      GridLines="Vertical" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"&gt;
      &lt;RowStyle BackColor="#F7F7DE" /&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField HeaderText="TransactionKey" SortExpression="TransactionKey"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="TextBoxGridViewTransactionKey" runat="server" Text='&lt;%# Bind("TextBoxTransactionKey") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="LabelGridViewTransactionKey" runat="server" Text='&lt;%# Bind("TextBoxTransactionKey") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;HeaderStyle Font-Size="14px" /&gt;
              &lt;ItemStyle Font-Size="12px" /&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="TerminalID" SortExpression="TerminalID"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="TextBoxGridViewTerminalID" runat="server" Text='&lt;%# Bind("TextBoxTerminalID") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="LabelGridViewTerminalID" runat="server" Text='&lt;%# Bind("TextBoxTerminalID") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;HeaderStyle Font-Size="14px" /&gt;
              &lt;ItemStyle Font-Size="12px" /&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="MerchantID" SortExpression="MerchantID"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="TextBoxGridViewMerchantID" runat="server" Text='&lt;%# Bind("TextBoxMerchantID") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="LabelGridViewMerchantID" runat="server" Text='&lt;%# Bind("TextBoxMerchantID") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;HeaderStyle Font-Size="14px" /&gt;
              &lt;ItemStyle Font-Size="12px" /&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="شماره حساب" SortExpression="شماره حساب"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="TextBoxGridViewBankAccount" runat="server" Text='&lt;%# Bind("TextBoxBankAccount") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="LabelGridViewBankAccount" runat="server" Text='&lt;%# Bind("TextBoxBankAccount") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;HeaderStyle Font-Size="14px" /&gt;
              &lt;ItemStyle Font-Size="12px" /&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="نام بانک" SortExpression="نام بانک"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="TextBoxGridViewBankName" runat="server" Text='&lt;%# Bind("BankName") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="LabelGridViewBankName" runat="server" Text='&lt;%# Bind("BankName") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;HeaderStyle Font-Size="14px" /&gt;
              &lt;ItemStyle Font-Size="12px" /&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:CommandField ShowSelectButton="True" &gt;
          &lt;ItemStyle Font-Size="12px" /&gt;
          &lt;/asp:CommandField&gt;
      &lt;/Columns&gt;
      &lt;FooterStyle BackColor="#CCCC99" /&gt;
      &lt;PagerStyle ForeColor="Black" HorizontalAlign="Right" BackColor="#F7F7DE" /&gt;
      &lt;SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" /&gt;
      &lt;HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" /&gt;
      &lt;AlternatingRowStyle BackColor="White" /&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>I set the DataSource with the follwing code :</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      try
      {
          LabelTitr.Text = "Add Banks";
          LabelResult.Text = "";
          if (Session["Username"] != null)
          {
              string permission = "";
              bool login = PublicMethods.CheckUsernamePass(Session["Username"].ToString(), Session["Password"].ToString(), out permission);
              if (!login)
              {
                  permission = "";
                  Response.Redirect("../Default.aspx");
                  Session["Username"] = Session["Password"] = null;
                  return;
              }
          }
          else
          {
              Response.Redirect("../Default.aspx");
              Session["Username"] = Session["Password"] = null;
              return;
          }
  
          if (!IsPostBack)
              BindDataToGridView1();
      }
      catch (Exception ex)
      {
          LabelResult.Text = ex.Message;
      }
  }
  
  void BindDataToGridView1()
  {
      try
      {
          DataSet1 dataSet = new DataSet1();
          DataClasses2DataContext dbc2 = new DataClasses2DataContext();
          var Definitions = dbc2.Definitions;
          if (Definitions.Count() &lt;= 0) return;
          foreach (var Definition in Definitions)
          {
              string bankName = dbc2.Banks.Where(c =&gt; c.BankID == Definition.BankID).First().BankName;
              string CheckBox = "&lt;input name=\"CheckBoxSubmitChanges\" type=\"checkbox\" value=" + Definition.DefinitionID + " /&gt;";
              dataSet.DataTableBanks.Rows.Add(bankName, Definition.BankAccount, Definition.MerchantID, Definition.TerminalID, Definition.TerminalID);
              GridView1.DataSource = dataSet.DataTableBanks;
          }
          GridView1.DataBind();
      }
      catch (Exception ex)
      {
          LabelResult.Text = ex.Message;
      }
  }
  </code></pre>
  
  <p>and this is GridView1_SelectedIndexChanged method :</p>
  
  <pre><code>protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
  {
      GridViewRow row = GridView1.SelectedRow;
      string temp = row.Cells[4].Text;
      LabelResult.Text = temp;
  }
  </code></pre>
  
  <p>But always <code>temp string</code> is empty !!!<br />
  What's wrong with it ?<br />
  Thanks</p>