//dynamically spawn the subcategory buttons according to selected category and language private void SpawnSubCategories(string category) { var languagePrefix = settings.language.ToString(); TextAsset loadedFile = Resources.Load <TextAsset>("Data/Localization/" + languagePrefix + "/Categories/" + category); SubcategoryList subcategoryList = JsonUtility.FromJson <SubcategoryList>(loadedFile.text); foreach (string subcategory in subcategoryList.subcategories) { UIButton button = buttonFactory.GetNewInstance(subCategoryPanel, subcategory, "Prefabs/UI/IndexButton"); subCategoryButtons.Add(button); } }
protected void CategoryList_SelectedIndexChanged(object sender, EventArgs e) { String catid = CategoryList.SelectedValue.ToString(); //Response.Write(catid); conn = new MySqlConnection(GetConnectionString()); Specification1.Visible = false; SpecificationRList1.Visible = false; Specification2.Visible = false; SpecificationRList2.Visible = false; Specification3.Visible = false; SpecificationRList3.Visible = false; Specification4.Visible = false; SpecificationRList4.Visible = false; Specification5.Visible = false; SpecificationRList5.Visible = false; Specification6.Visible = false; SpecificationRList6.Visible = false; Specification7.Visible = false; SpecificationRList7.Visible = false; try { conn.Open(); MySqlCommand comm = new MySqlCommand("Select Subcategory_Name,Subcategory_ID from Subcategory where Category_ID='" + catid + "'", conn); MySqlDataReader dr = comm.ExecuteReader(); SubcategoryList.DataSource = dr; SubcategoryList.DataTextField = "Subcategory_Name"; SubcategoryList.DataValueField = "Subcategory_ID"; SubcategoryList.DataBind(); dr.Close(); comm.CommandText = mainquery + " and Category_ID='" + catid + "'" + condition; MySqlDataReader dr1 = comm.ExecuteReader(); ProductsGrid.DataSource = dr1; ProductsGrid.DataBind(); dr1.Close(); } catch (Exception ex) { Response.Write("In category list"); Response.Write(ex.Message); } finally { conn.Close(); } SubcategoryList.Items.Insert(0, new ListItem("", "0")); }
private void ValidateCategorySelected() { if (SelectedCategoryItem == CategoryItems[0]) { IsFirstCategorySelected = true; SubcategoryItems = SubcategoryList.GetSubcategoryList(); ValidateSubcategorySelected(); IsCategorySelected = IsSubcategorySelected; } else { IsFirstCategorySelected = false; SelectedSubcategoryItem = null; IsSubcategorySelected = false; IsCategorySelected = SelectedCategoryItem != null; } }
public DeadLoadsViewModel() { CategoryList = new CategoryList(); SubcategoryList = new SubcategoryList(); MaterialList = new MaterialList(); }
protected void CategoryList_SelectedIndexChanged(object sender, EventArgs e) { String catid = CategoryList.SelectedValue.ToString(); //Response.Write(catid); conn = new MySqlConnection(GetConnectionString()); Specification1.Visible = false; SpecificationRList1.Visible = false; Specification2.Visible = false; SpecificationRList2.Visible = false; Specification3.Visible = false; SpecificationRList3.Visible = false; Specification4.Visible = false; SpecificationRList4.Visible = false; Specification5.Visible = false; SpecificationRList5.Visible = false; Specification6.Visible = false; SpecificationRList6.Visible = false; Specification7.Visible = false; SpecificationRList7.Visible = false; Label5.Visible = false; Label6.Visible = false; TextBox5.Visible = false; TextBox6.Visible = false; Button11.Visible = false; Button12.Visible = false; Button5.Visible = false; try { conn.Open(); MySqlCommand comm = new MySqlCommand("Select Subcategory_Name,Subcategory_ID from Subcategory where Category_ID='" + catid + "'", conn); MySqlDataReader dr = comm.ExecuteReader(); SubcategoryList.DataSource = dr; SubcategoryList.DataTextField = "Subcategory_Name"; SubcategoryList.DataValueField = "Subcategory_ID"; SubcategoryList.DataBind(); dr.Close(); comm.CommandText = "Select Product_ID,CONCAT(Company_Name,' ',Product_Name,' ',Sp4_Value,' ',Sp5_Value,' ',Sp6_Value,' ',Sp7_Value,' ',Sp8_Value,' MRP ',Retail_Price,' WP ',Wholesale_Price,' Stock ',Stock) from Master_Products where Category_ID='" + catid + "'"; MySqlDataReader dr1 = comm.ExecuteReader(); ProductsList.DataSource = dr1; ProductsList.DataTextField = "CONCAT(Company_Name,' ',Product_Name,' ',Sp4_Value,' ',Sp5_Value,' ',Sp6_Value,' ',Sp7_Value,' ',Sp8_Value,' MRP ',Retail_Price,' WP ',Wholesale_Price,' Stock ',Stock)"; ProductsList.DataValueField = "Product_ID"; ProductsList.DataBind(); dr1.Close(); } catch (Exception ex) { Response.Write("In category list"); Response.Write(ex.Message); } finally { conn.Close(); } SubcategoryList.Items.Insert(0, new ListItem("", "0")); }