protected void BindData(string str) { string[] startdate = getdate(str); int firstdate = Convert.ToInt32(startdate[1]); int lastdate = firstdate + 7; string enddate = startdate[0]+"/"+Convert.ToString(lastdate)+"/"+startdate[2]; if (conn.State == ConnectionState.Closed) conn.Open(); SqlCommand cmd = new SqlCommand("SELECT DISTINCT CONVERT (varchar(25), Cale_WeekDate,106) AS 'Date',Cale_DayName AS 'Day',Cale_Task8 AS '08:00 AM',Cale_Task9 AS '09:00 AM',Cale_Task10 AS '10:00 AM',Cale_Task11 AS '11:00 AM',Cale_Task12 AS '12:00 PM',Cale_Task13 AS '1:00 PM' FROM Calendar WHERE Cale_WeekDate BETWEEN '"+str+"' AND '"+enddate+"'", conn); DataSet ds = new DataSet(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); GridView gvTimeSheet = new GridView(); //gvTimeSheet.ID = "gvTimeSheet" + gridcount; gvTimeSheet.AutoGenerateColumns = false; dt = ds.Tables[0]; for (int i = 0; i < dt.Columns.Count; i++) { BoundField boundfield = new BoundField(); boundfield.DataField = dt.Columns[i].ColumnName.ToString(); boundfield.HeaderText = dt.Columns[i].ColumnName.ToString(); gvTimeSheet.Columns.Add(boundfield); } gvTimeSheet.DataSource = dt; gvTimeSheet.DataBind(); gvTimeSheet.Width = 600; gvTimeSheet.HeaderStyle.CssClass = "header"; gvTimeSheet.RowStyle.CssClass = "rowstyle"; Panel1.Controls.Add(gvTimeSheet); HtmlGenericControl linebreak = new HtmlGenericControl("br"); Panel1.Controls.Add(linebreak); }
RowEditing
RowDeleting
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)