private void GetRYear() { try { RevenueBLL rvBLL = new RevenueBLL(); DataTable dt = rvBLL.GetRYear(); ddlRYear.DataTextField = "R_YEAR"; ddlRYear.DataValueField = "R_YEAR"; ddlRYear.DataSource = dt; ddlRYear.DataBind(); ddlRYear.Items.Insert(0, new ListItem(string.Empty, string.Empty)); } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { lbLanguage.Text = Page.UICulture;//查看網頁的語系 #region ddl binding ddlArea.DataTextField = "AreaName"; ddlArea.DataValueField = "AreaName"; ddlArea.DataSource = getAreaData(); ddlArea.DataBind(); ddlArea.Items.Insert(0, new ListItem { Text = "請選擇", Value = "" }); ddlCityName.DataTextField = "CityName"; ddlCityName.DataValueField = "CityName"; ddlCityName.DataSource = getCityData(); ddlCityName.DataBind(); ddlCityName.Items.Insert(0, new ListItem { Text = "全部", Value = "" }); DataTable dtStore = getStoreData(""); for (int i = 0; i < dtStore.Rows.Count; i++) { ddlStore.Items.Add(new ListItem(string.Format("{0}({1})", dtStore.Rows[i]["StoreName"].ToString(), dtStore.Rows[i]["CityName"].ToString()), dtStore.Rows[i]["StoreNo"].ToString())); } ddlStore.Items.Insert(0, new ListItem { Text = "全部", Value = "" }); ddlProdGroup.DataTextField = "ProdGroup"; ddlProdGroup.DataValueField = "ProdGroup"; ddlProdGroup.DataSource = GetProdGroup(); ddlProdGroup.DataBind(); ddlProdGroup.Items.Insert(0, new ListItem { Text = "全部", Value = "" }); RevenueBLL rvBLL = new RevenueBLL(); DataTable dt = rvBLL.GetRYear(); ddlRevenueYear.DataTextField = "R_YEAR"; ddlRevenueYear.DataValueField = "R_YEAR"; ddlRevenueYear.DataSource = dt; ddlRevenueYear.DataBind(); ddlYearSingle.DataTextField = "R_YEAR"; ddlYearSingle.DataValueField = "R_YEAR"; ddlYearSingle.DataSource = dt; ddlYearSingle.DataBind(); ddlYearSingle.Items.Insert(0, new ListItem { Text = "", Value = "" }); ddlYearMultiple.DataTextField = "R_YEAR"; ddlYearMultiple.DataValueField = "R_YEAR"; ddlYearMultiple.DataSource = dt; ddlYearMultiple.DataBind(); //ddlYearMultiple.Items.Insert(0, new ListItem { Text = "Select an option", Value = "-1" }); #endregion //btnEnableTab.ToolTip = "Save Data"; this.hdnParameterA.Value = "Y"; this.hdnParameterB.Value = JsonHelper.DataTableToJson(getRevenueData("", "", "")); } }