Redirect via datagridView
<p>I am currently working in ASP.Net / C#. I am trying to make the server redirect to another page using via the rows in a datagrid, however, my code doesn't seem 
to work. Any help would be appreciated. </p>

<p>
                              
                              
                              
                              
                              
                              
                              
                              
                              
                              
                              
                          </p>

<pre><code>  protected void GridView1_RowCreated()
{
    foreach (GridViewRow row in GridView1.Rows)
    {
        Color color = row.BackColor;
        string color2 = System.Drawing.ColorTranslator.ToHtml(color);
        Session["" + row.Cells[0].Text + ""] = row.Cells[0].Text;
        //row.Attributes.Add("onclick", "zz(); return false;");
        /*if (row.RowState == DataControlRowState.Alternate)
        {
            row.Attributes.Add("onclick", "redirectFunction(); return false;");
            //row.Attributes.Add("onmouseover", "this.style.backgroundColor='   #FFFFFF';");
            //row.Attributes.Add("onmouseout", "this.style.backgroundColor='" + color2 + "';");
            //row.Attributes.Add("onclick", cookie.Value = row. GridView1.SelectedRow.Cells[0].Text);
            //row.Attributes.Add("onclick", "zz(); return false;");
        }
        else
        {
            //row.Attributes.Add("onmouseover", "this.style.backgroundColor='   #FFFFFF';");
            //row.Attributes.Add("onmouseout", "this.style.backgroundColor='" + color2 + "';");
            //row.Attributes.Add("onclick", "zz(); return false;");
        }*/
    }
}

        public void redirectFunction()
        {
    Response.RedirectPermanent("View.aspx");
        }

        Other page 
        if(Session["session"].ToString() != null)
        {
            // do something
        }
</code></pre>
