public void fillrepeater(Nullable<DateTime> date, string type) { ds = new DataSet(); objData = new DairyData(); ds = objData.GetDiary(date, type); string title = ""; if (ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0) { divmsg.InnerHtml = string.Empty; divrep.Visible = true; title = Convert.ToString(ds.Tables[2].Rows[0][0]); // ltH.Text = title; DataTable dtbody = ds.Tables[1].Copy(); DataRow dr = dtbody.NewRow(); dr["rep"] = title; dtbody.Rows.InsertAt(dr, 0); Session["PagedData"] = dtbody; PagedDataSource pagedData = new PagedDataSource(); pagedData.DataSource = dtbody.DefaultView; pagedData.AllowPaging = true; pagedData.PageSize = 15; pagedData.CurrentPageIndex = pageNum; StringBuilder html = new StringBuilder(); //Table start. html.Append("<table id ='tab' cellpadding='0'>"); StringBuilder sb1 = new StringBuilder(); for (int i = 0; i < dtbody.Rows.Count; i++) { html.Append(dtbody.Rows[i][0].ToString()); } //Table end. html.Append("</table>"); //Append the HTML string to Placeholder. PlaceHolder1.Controls.Add(new Literal { Text = html.ToString() }); // rep.DataSource = pagedData; // rep.DataBind(); // ScriptManager.RegisterStartupScript(Page, this.GetType(), "Key1", "<script>BindTable('"+sb1+"'); </script>", false); // lblCurrentPage.Text = "Page " + Convert.ToString(pagedData.CurrentPageIndex) + " of " + Convert.ToString(pagedData.PageCount); //if (pageNum == 0) //{ // btnPrev.Visible = false; //} //else //{ btnPrev.Visible = true; } //if (pageNum >= Math.Floor((decimal)ds.Tables[1].Rows.Count / 15)) //{ // btnNext.Visible = false; //} //else { btnNext.Visible = true; } //bindliteral(ds); ScriptManager.RegisterStartupScript(Page, this.GetType(), "Key", "<script>MakeStaticHeader('tab', 250, 900 , 60 ,true); </script>", false); } else { divmsg.InnerHtml = "No Records Found!"; divrep.Visible = false; } }
public void Seasonfill() { ds = new DataSet(); objData = new DairyData(); ds = objData.GetSeasonDates(); ddlSeason.DataSource = ds; ddlSeason.DataTextField = "Dates"; ddlSeason.DataValueField = "value"; ddlSeason.DataBind(); ddlSeason.Items.Insert(0, "--Select--"); int cfinyear = (System.DateTime.Now.Month < 7) ? System.DateTime.Now.Year - 1 : System.DateTime.Now.Year; ddlSeason.SelectedIndex = ddlSeason.Items.IndexOf(ddlSeason.Items.FindByValue(cfinyear.ToString())); }