Iam building a web application. which requires a grid view with drill down . Code
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; using System.Net.Mail;
public partial class PcocDash : System.Web.UI.Page { string id = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
DataTable dtprocdash = new DataTable();
dtprocdash.Columns.Add("UOM");
dtprocdash.Columns.Add("Jan");
dtprocdash.Columns.Add("Feb");
dtprocdash.Columns.Add("Mar");
#region PRStatus Header DataRow dr = dtprocdash.NewRow(); dr["UOM"] = "";
dtprocdash.Rows.Add(dr);
endregion
region No of POs
DataRow drprwithsla = dtprocdash.NewRow();
drprwithsla["UOM"] = "No";
SqlConnection co1 = new SqlConnection();
co1.ConnectionString = DataBaseOperation.GetConnectioString();
SqlCommand cmd1 = new SqlCommand();
cmd1.Connection = co1;
cmd1.CommandText = strQuery;
co1.Open();
//SqlDataReader rd = cmd.ExecuteReader();
SqlDataReader rd1;
rd1 = cmd1.ExecuteReader();
while (rd1.Read())
{
drprwithsla[2] = rd1["Jan"].ToString();
drprwithsla[3] = rd1["Feb"].ToString();
drprwithsla[4] = rd1["Mar"].ToString();
}
co1.Close();
dtprocdash.Rows.Add(drprwithsla);
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.RowIndex == 0) { GridViewRow gvRow = e.Row; gvRow.Cells[0].Text = "PR Status"; gvRow.Cells[0].BackColor = System.Drawing.Color.Yellow; gvRow.Cells[0].HorizontalAlign = HorizontalAlign.Left; gvRow.Cells[0].Font.Italic = true; gvRow.Cells[0].Font.Bold = true;
}
if (e.Row.RowIndex == 1)
{
GridViewRow gvRow = e.Row;
gvRow.Cells[0].Text = "Total no of PR's";
gvRow.Cells[0].BackColor = System.Drawing.Color.Wheat;
gvRow.Cells[0].HorizontalAlign = HorizontalAlign.Right;
gvRow.Cells[0].Font.Italic = true;
}
}
The issue is i have created a grid in aspx page and all the columns have been added in .cs file . Please some one help me out . how to add hyperlink in this page . Iam really new to the .net . Thanks in advance for any response