//Метод изменения настроек, вызывается при сменен значения в DropDownListMain события DropDownList1_SelectedIndexChanged(object sender, EventArgs e) private void SelectedIndexChanged() { int.TryParse(DropDownListMain.SelectedValue, out ItemSelected); LabelInfo.Text = ""; LabelStatus.Text = ""; ButtonGetDataList.Text = buttonget + DropDownListMain.SelectedItem + ")"; switch (ItemSelected) { case 0: LabelFromCategory.Visible = false; LabelFromCategory.Enabled = false; DropDownListCategory.Visible = false; DropDownListCategory.Enabled = false; break; case 1: LabelFromCategory.Visible = true; LabelFromCategory.Enabled = true; DropDownListCategory.Visible = true; DropDownListCategory.Enabled = true; DropDownListCategory.DataBind(); break; } }
public void retrievedata() { DropDownListsupplier1.DataSource = maintainCatalogueController.GetSupplierList(); DropDownListsupplier1.DataTextField = "SupplierName"; DropDownListsupplier1.DataValueField = "SupplierId"; DropDownListsupplier1.DataBind(); DropDownListsupplier2.DataSource = maintainCatalogueController.GetSupplierList(); DropDownListsupplier2.DataTextField = "SupplierName"; DropDownListsupplier2.DataValueField = "SupplierId"; DropDownListsupplier2.DataBind(); DropDownListsupplier3.DataSource = maintainCatalogueController.GetSupplierList(); DropDownListsupplier3.DataTextField = "SupplierName"; DropDownListsupplier3.DataValueField = "SupplierId"; DropDownListsupplier3.DataBind(); DropDownListCategory.DataSource = maintainCatalogueController.GetCategoryList(); DropDownListCategory.DataTextField = "CategoryName"; DropDownListCategory.DataValueField = "CategoryId"; DropDownListCategory.DataBind(); DropDownListuom.DataSource = maintainCatalogueController.GetUomList(); DropDownListuom.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { User u = (User)Session["UserEntity"]; if (u == null || u.RoleId != 5) { Response.Redirect("../Security.aspx"); } if (!IsPostBack) { //User userbean = (User)Session["UserEntity"]; //Supervisor.Text = "Hello," + userbean.Name; List <Department> listDepartment = df.GetDepName(); DropDownListDepartment.DataSource = listDepartment; DropDownListDepartment.DataTextField = "deptName"; DropDownListDepartment.DataValueField = "deptName"; DropDownListDepartment.DataBind(); List <RequestItem> listCategary = rif.GetCategoryName(); DropDownListCategory.DataSource = listCategary; DropDownListCategory.DataTextField = "CategoryName"; DropDownListCategory.DataValueField = "CategoryName"; DropDownListCategory.DataBind(); } }
private void BindClaimSkuCategory() { DropDownListCategory.DataSource = ClaimSku.GetClaimSkuCategoryList(); DropDownListCategory.DataTextField = "Description"; DropDownListCategory.DataValueField = "ClaimSkuCategoryId"; DropDownListCategory.DataBind(); DropDownListCategory.Items.Insert(0, new ListItem("Please select", "0")); }
private void ShowCategory() { if (!IsPostBack) { KategoriDb db = new KategoriDb(); DropDownListCategory.DataSource = db.CategoriesShow(); DropDownListCategory.DataValueField = "Kategori_ID"; DropDownListCategory.DataTextField = "Kategori_Ad"; DropDownListCategory.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //Populate categories dropdown list Category cat = new Category(); List <Category> categories = cat.GetAllCategories(true); DropDownListCategory.DataSource = categories; DropDownListCategory.DataTextField = "Name"; DropDownListCategory.DataValueField = "CategoryID"; DropDownListCategory.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //Obtain product code from query string string prodcd = Request.QueryString["prodcd"].ToString(); //Get product by its code Product prod = new Product(); prod.GetProductByCode(prodcd); //Populate categories dropdown list Category cat = new Category(); List <Category> categories = cat.GetAllCategories(true); DropDownListCategory.DataSource = categories; DropDownListCategory.DataTextField = "Name"; DropDownListCategory.DataValueField = "CategoryID"; DropDownListCategory.DataBind(); //Put product details into fields LabelProductCode.Text = Request.QueryString["prodcd"].ToString(); TextBoxName.Text = prod.Name.ToString(); TextBoxBrand.Text = prod.Brand.ToString(); TextBoxDescription.Text = prod.Description.ToString(); DropDownListCategory.SelectedValue = prod.CategoryID.ToString(); TextBoxMSRP.Text = prod.Msrp.ToString(); CheckBoxFreeShipping.Checked = Convert.ToBoolean(prod.IsFreeShipping); CheckBoxTaxFree.Checked = Convert.ToBoolean(prod.IsTaxFree); TextBoxQtyInStock.Text = prod.QuantityInStock.ToString(); CheckBoxQtyUnlimited.Checked = Convert.ToBoolean(prod.IsQuantityUnlimited); LabelCreated.Text = Convert.ToDateTime(prod.Created).ToShortDateString(); if (Convert.ToDateTime(prod.Modified) > DateTime.MinValue) { LabelModified.Text = Convert.ToDateTime(prod.Modified).ToShortDateString(); } else { LabelModified.Text = "N/A"; } //Attempt to display image (if it is found) try { Image1.ImageUrl = "~/Images/Product_Images/" + LabelProductCode.Text + ".jpg"; } catch (Exception) { Image1.ImageUrl = ""; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { txtStartDate.Text = System.DateTime.Now.ToString("MM/dd/yyyy"); // Categories List <JsonCintGeneral> categories; if (Session["ListCategories"] == null) { categories = JsonConvert.DeserializeObject <List <JsonCintGeneral> >(jsonGET("https://api.cintworks.net/ordering/reference/survey/categories")); Session["ListCategories"] = categories; } else { categories = (List <JsonCintGeneral>)Session["ListCategories"]; } List <JsonCintGeneral> categoriesSortedList = categories.OrderBy(o => o.name).ToList(); DropDownListCategory.DataSource = categoriesSortedList; DropDownListCategory.DataTextField = "name"; DropDownListCategory.DataValueField = "id"; DropDownListCategory.DataBind(); List <JsonCintGeneral> countries; if (Session["ListCountries"] == null) { countries = JsonConvert.DeserializeObject <List <JsonCintGeneral> >(jsonGET("https://api.cintworks.net/ordering/reference/countries")); Session["ListCountries"] = countries; } else { countries = (List <JsonCintGeneral>)Session["ListCountries"]; } List <JsonCintGeneral> countriesSortedList = countries.OrderBy(o => o.name).ToList(); DropDownListCountry.DataSource = countriesSortedList; DropDownListCountry.DataTextField = "name"; DropDownListCountry.DataValueField = "id"; DropDownListCountry.DataBind(); DropDownListCountry.SelectedValue = "22"; } }
private void Reset() { ViewState["ClaimId"] = null; this.claimId = 0; DropDownListCategory.ClearSelection(); BindClaimSkuCategory(); DropDownListSubCategory.ClearSelection(); BindClaimSkuSubCategory(); TextBoxValue.Text = "0"; TextBoxQuantity.Text = "0"; TextBoxComment.Text = ""; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string constr = ConfigurationManager.ConnectionStrings["Registration"].ConnectionString; SqlConnection connec = new SqlConnection(constr); string S = "spselect"; SqlCommand com = new SqlCommand(S, connec); connec.Open(); com.CommandType = CommandType.StoredProcedure; DropDownListCategory.DataSource = com.ExecuteReader(); DropDownListCategory.DataTextField = "Category Name"; DropDownListCategory.DataValueField = "Cat ID"; DropDownListCategory.DataBind(); connec.Close(); } }
protected void newCategoryConfirmButton_Click(object sender, EventArgs e) { // Create connnection to RB_RecipeBook database SqlConnection conn; SqlCommand comm; SqlDataReader reader; // Read the connection string from Web.config string connectionString = ConfigurationManager.ConnectionStrings["RB_RecipeBook"].ConnectionString; conn = new SqlConnection(connectionString); // Create sql command with insert statement comm = new SqlCommand("INSERT RB_Category (CategoryName) " + "VALUES(@CategoryName);", conn); // Create parameters comm.Parameters.Add("@CategoryName", System.Data.SqlDbType.NVarChar); comm.Parameters["@CategoryName"].Value = newCategoryTextBox.Text; try { conn.Open(); comm.ExecuteNonQuery(); } catch { MessageLabel.Text = "Error while adding the new category. Try again!"; } finally { conn.Close(); } // Hyde new category objects newCategoryTextBox.Visible = false; newCategoryTextBox.Enabled = false; newCategoryConfirmButton.Visible = false; // Bind drop down list category again to refresh DropDownListCategory.DataBind(); // Select the new added category DropDownListCategory.SelectedIndex = DropDownListCategory.Items.Count - 1; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <string> dataSource = new List <string>(); dataSource.Add("All Roles"); dataSource.Add(Core.Models.User.Category.Admin.ToString()); dataSource.Add(Core.Models.User.Category.Faculty.ToString()); dataSource.Add(Core.Models.User.Category.Moderator.ToString()); dataSource.Add(Core.Models.User.Category.Staff.ToString()); dataSource.Add(Core.Models.User.Category.Student.ToString()); DropDownListCategory.DataSource = dataSource; //DropDownListCategory.CssClass = "w3-dropdown-content w3-bar-block w3-border"; DropDownListCategory.DataBind(); //LoadTable(""); } LoadTable(TextBoxSearchUserAccount.Text); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //--------Testing with hard coded user id------- //Session["userId"] = new Guid(); if (Session["userId"] == null) { LinkButtonHistory.Visible = false; } // Dropdown box DataSet ds = client.SelectDistinctLocationFromBranch(); DropDownListLocation.DataSource = ds; DropDownListLocation.DataTextField = "city"; DropDownListLocation.DataValueField = "city"; DropDownListLocation.DataBind(); DropDownListLocation.Items.Insert(0, new ListItem("All", "All")); ds = client.SelectDistinctCategoryFromBranch(); DropDownListCategory.DataSource = ds; DropDownListCategory.DataTextField = "category"; DropDownListCategory.DataValueField = "category"; DropDownListCategory.DataBind(); DropDownListCategory.Items.Insert(0, new ListItem("All", "All")); Session["search"] = ""; // Display search Result BindListView(); } // Autofill for search Names = client.SelectDistinctShopNameFromBranch().ToList <String>(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable oDT_Category = DBService.GetCategory(); DataTable oDT_SubmitDate = DBService.GetSubmitDates(); DropDownListCategory.DataSource = oDT_Category; DropDownListCategory.DataValueField = "CategoryId"; DropDownListCategory.DataTextField = "CategoryName"; DropDownListCategory.DataBind(); DropDownListCategory.AutoPostBack = true; DropDownListSubmitDate.DataSource = oDT_SubmitDate; DropDownListSubmitDate.DataValueField = "SubmitDate"; DropDownListSubmitDate.DataTextField = "SubmitDateText"; DropDownListSubmitDate.DataBind(); DropDownListSubmitDate.AutoPostBack = true; LoadContent(); } }
protected void Page_Load(object sender, EventArgs e) { if (HttpContext.Current.User.Identity.IsAuthenticated) { if (!IsPostBack) { DropDownListCategory.DataSource = getData("getCategoriesNameAndId", null); DropDownListCategory.DataBind(); ListItem liCategory = new ListItem("اختر تصنيف", "-1"); DropDownListCategory.Items.Insert(0, liCategory); ListItem liFood = new ListItem("اختر الطعام", "-1"); DropDownListFood.Items.Insert(0, liFood); DropDownListFood.Enabled = false; } } else { Response.Redirect("Account//Login.aspx"); } }
private void BindClaim() { try { StoreRep.Web.Code.Claim claim = StoreRep.Web.Code.Claim.GetClaimByClaimId(this.claimId); /* * PayStore - 0 = No * PayStore - 1 = Yes * PayStore - 99 = Not indicated yet */ RadioButtonPayStoreNo.Checked = claim.PayStore == 0; RadioButtonPayStoreYes.Checked = claim.PayStore == 1; /* * SupplierClaimBack - 0 = No * SupplierClaimBack - 1 = Yes * SupplierClaimBack - 99 = Not indicated yet */ RadioButtonClaimSupplierNo.Checked = claim.SupplierClaimBack == 0; RadioButtonClaimSupplierYes.Checked = claim.SupplierClaimBack == 1; DropDownListSupplier.ClearSelection(); DropDownListSupplier.Items.FindByValue(claim.ClaimSupplierId.ToString()).Selected = true; //BindStore(); DropDownListStore.ClearSelection(); DropDownListStore.Items.FindByValue(claim.StoreId.ToString()).Selected = true; TextBoxClaimDate.Text = claim.FormattedClaimDateEdit.ToString(); TextBoxClaimNumber.Text = claim.ClaimNumber; DropDownListClaimType.ClearSelection(); DropDownListClaimType.Items.FindByValue(claim.ClaimTypeId.ToString()).Selected = true; DropDownListClaimResponsible.ClearSelection(); DropDownListClaimResponsible.Items.FindByValue(claim.ClaimResponsibleId.ToString()).Selected = true; DropDownListCategory.ClearSelection(); DropDownListCategory.Items.FindByValue(claim.ClaimSkuCategoryId.ToString()).Selected = true; BindClaimSkuSubCategory(); DropDownListSubCategory.ClearSelection(); DropDownListSubCategory.Items.FindByValue(claim.ClaimSkuSubCategoryId.ToString()).Selected = true; TextBoxValue.Text = claim.Value.ToString(); //PanelQuantity.Visible = Convert.ToInt32(DropDownListClaimType.SelectedValue) == 4; //Recall if (Convert.ToInt32(DropDownListClaimType.SelectedValue) == 4)//Recall { PanelBatchNumber.Visible = true; TextBoxBatchNumber.Text = claim.BatchNumber; } else { PanelBatchNumber.Visible = true; TextBoxBatchNumber.Text = ""; } TextBoxQuantity.Text = claim.Quantity.ToString(); TextBoxComment.Text = claim.Comment; TextBoxClaimReference.Text = claim.ClaimReference; TextBoxCaptureDate.Text = String.Format("{0:d/M/yyyy HH:mm:ss}", claim.CreatedDate); TextBoxCapturedBy.Text = claim.ModifiedUser; if (Convert.ToInt32(DropDownListSupplier.SelectedValue) == 2) //Monteagle Africa { PanelKeyAccount.Visible = true; DropDownListKeyAccount.ClearSelection(); DropDownListKeyAccount.Items.FindByValue(claim.KeyAccountId.ToString()).Selected = true; } else { PanelKeyAccount.Visible = false; } BindClaimTypeSelection(); } catch (System.Data.SqlClient.SqlException sqlEx) { for (int i = 0; i < sqlEx.Errors.Count; i++) { LabelError.Text += (sqlEx.Errors[i].Message + "<br />"); } PanelError.Visible = true; } catch (Exception exception) { LabelError.Text += (exception.Message + "<br />"); PanelError.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { User user = null; if (!IsPostBack) { if (Session["UserAccountId"] != null) { int id = Int16.Parse((string)Session["UserAccountId"]); user = UserController.GetInstance().Recover(id); HiddenFieldId.Value = id.ToString(); textboxEmail.Text = user.Email.Trim(); textboxFirstName.Text = user.FirstName; textboxLastName.Text = user.LastName; HiddenFieldPW.Value = user.Password; HiddenFieldVerified.Value = user.Verified.ToString(); } else { Account.Visible = false; buttonSave.Visible = false; } } if (user != null) { List <string> dataSource = new List <string>(); dataSource.Add(Core.Models.User.Category.Admin.ToString()); dataSource.Add(Core.Models.User.Category.Faculty.ToString()); dataSource.Add(Core.Models.User.Category.Moderator.ToString()); dataSource.Add(Core.Models.User.Category.Staff.ToString()); dataSource.Add(Core.Models.User.Category.Student.ToString()); DropDownListCategory.DataSource = dataSource; switch (user.category) { case Core.Models.User.Category.Admin: DropDownListCategory.SelectedIndex = 0; break; case Core.Models.User.Category.Faculty: DropDownListCategory.SelectedIndex = 1; break; case Core.Models.User.Category.Moderator: DropDownListCategory.SelectedIndex = 2; break; case Core.Models.User.Category.Staff: DropDownListCategory.SelectedIndex = 3; break; case Core.Models.User.Category.Student: DropDownListCategory.SelectedIndex = 4; break; } //DropDownListCategory.CssClass = "w3-dropdown-content w3-bar-block w3-border"; DropDownListCategory.DataBind(); } }