protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { // // Fill The Branches in the Combo // FillBranches(); string strYear = string.Empty; for (int i = 0; ; i++) { strYear = i.ToString(); strYear = (strYear.Length == 1) ? "200" + i.ToString() : "20" + i.ToString(); if (Convert.ToInt32(strYear) > DateTime.Now.Year) { break; } ddlStYear.Items.Insert(i, new ListItem(strYear, i.ToString())); ddlEndYear.Items.Insert(i, new ListItem(strYear, i.ToString())); } for (int j = 0; j <= ddlBranch.Items.Count - 1; j++) { if (ddlBranch.Items[j].Value.Trim() == Session["BranchID"].ToString()) { ddlBranch.Items[j].Selected = true; break; } } salesReportUtils.GetALLReps(ddlRep, ddlBranch.SelectedItem.Value); int month = (int)DateTime.Now.Month; int year = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2)); if (month != 1) { ddlEndMonth.Items[month - 2].Selected = true; ddlEndYear.Items[year].Selected = true; } else { ddlEndMonth.Items[ddlEndMonth.Items.Count - 1].Selected = true; ddlEndYear.Items[year - 1].Selected = true; } } } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { SystemCheck systemCheck = new SystemCheck(); systemCheck.SessionCheck(); Ajax.Utility.RegisterTypeForAjax(typeof(CustomerSalesAnalysisUserPrompt)); if (!IsPostBack) { ddlYear.Items.Clear(); string strYear = string.Empty; for (int i = 0; ; i++) { strYear = i.ToString(); strYear = (strYear.Length == 1) ? "200" + i.ToString() : "20" + i.ToString(); if (Convert.ToInt32(strYear) > DateTime.Now.Year) { break; } ddlYear.Items.Insert(i, new ListItem(strYear, strYear)); } // // Fill The Branches in the Combo // FillBranches(); int month = (int)DateTime.Now.Month; int year = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2)); if (month != 1) { ddlMonth.Items[month - 2].Selected = true; ddlYear.Items[year].Selected = true; } else { ddlMonth.Items[ddlMonth.Items.Count - 1].Selected = true; ddlYear.Items[year - 1].Selected = true; } for (int i = 0; i <= ddlBranch.Items.Count - 1; i++) { if (ddlBranch.Items[i].Value.Trim() == Session["BranchID"].ToString()) { ddlBranch.Items[i].Selected = true; break; } } salesReportUtils.GetALLReps(ddlRep, ddlBranch.SelectedItem.Value); } }