title: GridViews GridView1_SelectedIndexChanged is not working
body: <p>I have a gridview to populate data from DB with the last column elements either hyperlinked to a different page or just a text display (without hyperlink). I have stored the TransactionId in a cookie at GridView1_SelectedIndexChanged() event for each record in that gridview. But this event is not being triggered. </p>
  
  <p>The gridview is binded properly and the last column items based on type turns into Hyperlink at GridView1_RowDataBound(). The redirection to different page works fine, but since the SelectedIndexChanged() event isn't triggered, the cookie isn't loaded and the redirected page doesn't displays data. </p>
  
  <p>Please help me out guys. Thanks.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="Black" 
  GridLines="Vertical" Width="100%" RowStyle-Wrap="true" AllowPaging="True" 
  PageSize="5" OnPageIndexChanging="gridView_PageIndexChanging" 
  
  OnRowDataBound="GridView1_RowDataBound" onselectedindexchanged="GridView1_SelectedIndexChanged"
  
  AutoGenerateColumns="False" selectedindex="1" style="word-wrap:break-word; margin-left: 0px;" &gt;
      &lt;Columns&gt;
          &lt;asp:BoundField DataField="COL-1" HeaderText="COL1" /&gt;
          &lt;asp:BoundField DataField="COL-2" HeaderText="COL2" /&gt;
          &lt;asp:BoundField DataField="COL-3" HeaderText="COL3" /&gt;
          &lt;asp:BoundField DataField="COL-4" HeaderText="COL4" /&gt;
      &lt;/Columns&gt;
  
      &lt;AlternatingRowStyle BackColor="White" /&gt;
      &lt;FooterStyle BackColor="#CCCC99" /&gt;
      &lt;HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" /&gt;
  &lt;/asp:GridView&gt;
  
  
  protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
  {
      HttpCookie TransId = new HttpCookie("TransId");
      GridViewRow row = GridView1.SelectedRow;
      TransId.Value = row.Cells[0].Text;
      Response.Cookies.Add(TransId);
  }
  
  protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  {
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
          if (e.Row.Cells[3].Text.Equals("Pending"))
          {
              HyperLink link = new HyperLink();
              link.Text = "Pending";
              link.NavigateUrl = "NewPage.aspx";
              e.Row.Cells[3].Controls.Add(link);
          }
      }
  }
  </code></pre>