protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //CsProvince ProvinceList = new CsProvincelist(ProvinceTable); CsItemCat ItemCat = new CsItemCat(CategoryTable); try { ConnectionClass.GetItemCat(ItemCat); CategoryList.DataSource = ItemCat.itemCategory; CategoryList.DataTextField = ItemCat.itemCategory.Columns["categoryName"].ToString(); CategoryList.DataValueField = ItemCat.itemCategory.Columns["categoryCode"].ToString(); CategoryList.DataBind(); } finally { } for (int i = 0; i <= 100; i++) { qtyList.Items.Add(new ListItem(i.ToString(), i.ToString())); } } }
// Press UpdateButton protected void btnUpdate_Click(object sender, EventArgs e) { //Enable to use textbox, dropdownlist, enable to see upload control AbleTextBoxes(Page); //Enable to see upload button btnUpload.Visible = true; // Input qty list numbers qtyList.SelectedItem.Text = "Please Select"; for (int i = 1; i <= 100; i++) { qtyList.Items.Add(new ListItem(i.ToString(), i.ToString())); } // Input category list items CategoryList.SelectedItem.Text = "Please Select"; CsItemCat Itemcats = new CsItemCat(CategoryTable); ConnectionClass.GetItemCat(Itemcats); CategoryList.DataSource = Itemcats.itemCategory; CategoryList.DataTextField = Itemcats.itemCategory.Columns["categoryName"].ToString(); CategoryList.DataValueField = Itemcats.itemCategory.Columns["categoryName"].ToString(); CategoryList.DataBind(); btnUpdate.Visible = false; btnSave.Visible = true; }