protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var firstCell = e.Row.Cells[4]; firstCell.Controls.Clear(); Button btn_chk = new Button(); btn_chk.Text = firstCell.Text; btn_chk.CommandName = "btn_chk"; //firstCell.Controls.Add(new HyperLink { NavigateUrl = "Default.aspx?Search="+firstCell.Text+"|"+e.Row.Cells[3].Text, Text= firstCell.Text }); firstCell.Controls.Add(btn_chk); } } protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List<string> years = new List<string>(); for (int i = 0; i > -6; i--) { years.Add(DateTime.Now.AddYears(i).ToString("yyyy")); } drpYear.DataSource = years; drpYear.DataBind(); DataSet dt = GetExistingRecords(); GridView1.DataSource = dt; GridView1.DataBind(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)