Addin OnClick Event on Grid row and open new grid as per the selection
<p>Below you can find the code of my grid and every thing is working fine up to here. Now i want to add Click event on RegionProjectname so that when ever i click on the the Region project name row, the RegionProjectID of that column is stored in a session variable and a new grid will open based on the selected row. Please edit or guide me that how i do this .</p>

<p>I had already added Select row in the grid and that also working fine but i commented.</p>

<pre><code> &lt;asp:GridView ID="ResultGridView" runat="server" AutoGenerateColumns="False" ShowFooter="true"
    DataKeyNames="RegionProjectID" 
    AllowPaging="True" 
    CellPadding="3" 
    OnPageIndexChanging="ResultGridView_PageIndexChanging" 
    OnRowDeleting="ResultGridView_RowDeleting" 
    CssClass="mGrid"
    OnRowEditing="ResultGridView_RowEditing" OnRowUpdating="ResultGridView_RowUpdating" OnRowCancelingEdit="ResultGridView_RowCancelingEdit" PageSize="15" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellSpacing="2" OnRowCommand="ResultGridView_RowCommand" &gt;
        &lt;Columns&gt;
            &lt;asp:BoundField DataField="RegionProjectID" HeaderText="Region ID" InsertVisible="False"
                ReadOnly="True" SortExpression="RegionProjectID" Visible="false" /&gt;
            &lt;asp:TemplateField HeaderText="Region Name" SortExpression="RegionProjectName"&gt;
                &lt;EditItemTemplate&gt;
                    &lt;asp:TextBox ID="txtRegion" Width="250px" runat="server" Text='&lt;%# Bind("RegionProjectName") %&gt;'&gt;&lt;/asp:TextBox&gt;
                &lt;/EditItemTemplate&gt;
                &lt;FooterTemplate&gt;
                &lt;asp:TextBox ID="txtRegion1" runat="server"  Width="250px"&gt;&lt;/asp:TextBox&gt; 
                &lt;/FooterTemplate&gt;
                &lt;ItemTemplate&gt;
                    &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind("RegionProjectName") %&gt;'&gt;&lt;/asp:Label&gt;
                &lt;/ItemTemplate&gt;
            &lt;/asp:TemplateField&gt;

            &lt;asp:TemplateField HeaderText="Edit" ShowHeader="False"&gt; 
            &lt;EditItemTemplate&gt; 
              &lt;asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update"&gt;&lt;/asp:LinkButton&gt; 
              &lt;asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"&gt;&lt;/asp:LinkButton&gt; 
            &lt;/EditItemTemplate&gt; 
            &lt;FooterTemplate&gt; 
              &lt;asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="AddNew" Text="Add New"&gt;&lt;/asp:LinkButton&gt; 
            &lt;/FooterTemplate&gt; 
            &lt;ItemTemplate&gt; 
              &lt;asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"&gt;&lt;/asp:LinkButton&gt; 
            &lt;/ItemTemplate&gt; 
            &lt;/asp:TemplateField&gt; 
            &lt;asp:CommandField HeaderText="Delete" ShowDeleteButton="True"  ShowHeader="True" /&gt; 
           &lt;%-- &lt;asp:CommandField HeaderText="Select" ShowSelectButton="True"  ShowHeader="True" on/&gt; --%&gt;

        &lt;/Columns&gt;
        &lt;RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /&gt;
        &lt;FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /&gt;
        &lt;PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /&gt;
        &lt;%--&lt;SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /&gt;--%&gt;
        &lt;HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" /&gt;
    &lt;/asp:GridView&gt;
private void FillVendorGrid()
    {
        dataTable = new DataTable();
        cmd.Connection = conn;
        cmd.CommandText = "SELECT * FROM RegionAndProjectInfo where natureofWorkID= " + ddlnatureOfWork.SelectedValue.ToString(); ;
        ad = new SqlDataAdapter(cmd);
        ad.Fill(dataTable);
        ResultGridView.DataSource = dataTable;
        ResultGridView.DataBind();
    }

    protected void ResultGridView_RowEditing(object sender, GridViewEditEventArgs e)
    {
        ResultGridView.EditIndex = e.NewEditIndex;
        FillVendorGrid();
    }

    protected void ResultGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        ResultGridView.PageIndex = e.NewPageIndex;
        FillVendorGrid();
    }

    protected void ResultGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        cmd.Connection = conn;
        cmd.CommandText = "DELETE FROM RegionAndProjectInfo WHERE RegionProjectID='" + ResultGridView.DataKeys[e.RowIndex].Values[0].ToString() + "'";
        conn.Open();
        cmd.ExecuteNonQuery();
        conn.Close();
        FillVendorGrid();

    }

    protected void ResultGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox txtRegionname = (TextBox)ResultGridView.Rows[e.RowIndex].FindControl("txtRegion");
        TextBox txtNatureOFWork = (TextBox)ResultGridView.Rows[e.RowIndex].FindControl("txtNatureOFWork");
        cmd.Connection = conn;
        cmd.CommandText = "UPDATE RegionAndProjectInfo SET RegionProjectName ='" + txtRegionname.Text + "'   WHERE RegionProjectID='" + ResultGridView.DataKeys[e.RowIndex].Values[0].ToString() + "'";
        conn.Open();
        cmd.ExecuteNonQuery();
        ResultGridView.EditIndex = -1;
        FillVendorGrid();
        conn.Close();

    }

    protected void ResultGridView_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        ResultGridView.EditIndex = -1;
        FillVendorGrid();

    }

    protected void ResultGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("AddNew"))
        {

            TextBox txtRegion1 = (TextBox)ResultGridView.FooterRow.FindControl("txtRegion1");
            TextBox txtNatureOFWork1 = (TextBox)ResultGridView.FooterRow.FindControl("txtNatureOFWork1");
            if (txtRegion1.Text != "")
            {
                cmd.Connection = conn;
                cmd.CommandText = "INSERT INTO RegionAndProjectInfo(RegionProjectName, NatureOFWorkID ) Values('" + txtRegion1.Text + "', '" + ddlnatureOfWork.SelectedValue.ToString() + "')";
                conn.Open();
                cmd.ExecuteNonQuery();
            }
            FillVendorGrid();
            conn.Close();
        }
    }

    protected void ddlnatureOfWork_SelectedIndexChanged(object sender, EventArgs e)
    {
        FillVendorGrid();
    }
</code></pre>
