//Bind your Grid View here private void BindTaskList(int PromoterID, string FromMonth, string ToMonth, int CurrentYear, int IsAll) { clsPromotionFactory fac = new clsPromotionFactory(); int pageNumber = Convert.ToInt32(ViewState["PageNumber"]); int PageSize = 100; string sortcolumn = ViewState["SortColumn"].ToString(); DataSet Promoter = fac.GetSongByPromoterID(PromoterID, FromMonth, ToMonth, CurrentYear, 0, pageNumber, PageSize, sortcolumn, null); DataTable myDataTable = Promoter.Tables[0]; //Set your DataTable here ViewState["Count"] = Promoter.Tables[1]; grd.DataSource = myDataTable; grd.DataBind(); }
protected void btnComplete_Click(object sender, EventArgs e) { int PromoterID = Convert.ToInt32(hdnID.Value); clsPromotionFactory fac = new clsPromotionFactory(); int pageNumber = Convert.ToInt32(ViewState["PageNumber"]); int PageSize = 100; string sortcolumn = ViewState["SortColumn"].ToString(); DataSet Promter = fac.GetSongByPromoterID(PromoterID, string.Empty, string.Empty, DateTime.Now.Year, 1, pageNumber, PageSize, sortcolumn, null); DataTable myDataTable = Promter.Tables[0]; //Set your DataTable here grd.DataSource = myDataTable; grd.DataBind(); }
protected void btnSearch_Click(object sender, EventArgs e) { string FromMonths = ddlFrom.SelectedItem.Value; string ToMonths = ddlTo.SelectedItem.Value; if (!string.IsNullOrEmpty(FromMonths)) { string[] FromArr = FromMonths.Split('_'); string FromMonth = FromArr[0].ToString(); string[] ToArr = ToMonths.Split('_'); string ToMonth = ToArr[0].ToString(); int PromoterID = Convert.ToInt32(hdnID.Value); int YearName = Convert.ToInt32(FromArr[1].ToString()); clsPromotionFactory fac = new clsPromotionFactory(); int pageNumber = Convert.ToInt32(ViewState["PageNumber"]); int PageSize = 100; string sortcolumn = ViewState["SortColumn"].ToString(); DataSet Promter = fac.GetSongByPromoterID(PromoterID, FromMonth, ToMonth, YearName, 0, pageNumber, PageSize, sortcolumn, null); DataTable myDataTable = Promter.Tables[0]; //Set your DataTable here grd.DataSource = myDataTable; grd.DataBind(); } else { int PromoterID = Convert.ToInt32(hdnID.Value); DateTime Currentdate = DateTime.Now; int CurrentYear = Currentdate.Year; string CurrentMonth = Currentdate.ToString("MMMM"); string FromMonth = (CurrentMonth == "gennaio" ? "January" : CurrentMonth == "febbraio" ? "February" : CurrentMonth == "marzo" ? "March" : CurrentMonth == "aprile" ? "April" : CurrentMonth == "maggio" ? "May" : CurrentMonth == "giugno" ? "June" : CurrentMonth == "luglio" ? "July" : CurrentMonth == "agosto" ? "August" : CurrentMonth == "settembre" ? "September" : CurrentMonth == "ottobre" ? "October" : CurrentMonth == "novembre" ? "November" : CurrentMonth == "dicembre" ? "December" : CurrentMonth); string ToMonth = FromMonth; BindTaskList(PromoterID, FromMonth, ToMonth, CurrentYear, 0); } }