Friday, February 10, 2012

RowDataBound in gridview

protected void grvdata_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {

            if (Session["user"] == null)
            {
               Response.Redirect("../login.aspx");
            }
            else
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    DataRow dr = ((DataRowView)e.Row.DataItem).Row;
                  string applictnno = dr["applictnno"].ToString();
                    string Plotno= dr["Plotno"].ToString();
                    ((HyperLink)e.Row.FindControl("linkforallexec")).NavigateUrl = string.Format("~/pages/Executive.aspx?Plotno={0}", Plotno+ "&&applicationno="+ applictnno);  // navigate from one page to another page through using query string
               }
            }
        }
        catch (Exception)
        {

            throw;
        }
    }

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software