private void BindCategory() { try { DataSet ds = _objBOUtiltiy.GetAccountTypeOfSuppl(); if (ds.Tables[0].Rows.Count > 0) { DropDownCategory.DataSource = ds; DropDownCategory.DataTextField = "CategoryName"; DropDownCategory.DataValueField = "CategoryId"; DropDownCategory.DataBind(); DropDownCategory.Items.Insert(0, new ListItem("--Select Category--", "0")); } else { DropDownCategory.DataSource = null; DropDownCategory.DataBind(); DropDownCategory.Items.Insert(0, new ListItem("--Select Category--", "0")); } } catch (Exception ex) { lblMsg.Text = _objBOUtiltiy.ShowMessage("danger", "Danger", ex.Message); ExceptionLogging.SendExcepToDB(ex); } }
//dropdown categories public ActionResult Customer_Categories() { DropDownCategory entities = new DropDownCategory(); var result = db.DropDownCategories.ToList(); return(Json(result, JsonRequestBehavior.AllowGet)); }
protected void Page_Load(object sender, EventArgs e) { List <String> productCategoryList; if (!IsPostBack) { productCategoryList = Stationery_Catalogue_DAO.GetAllCategoryNames(); DropDownCategory.DataSource = productCategoryList; DropDownCategory.DataBind(); DropDownCategory.Items.Insert(0, new ListItem("Select", "NA")); } else { selectedproductList = (List <Stationery_Catalogue>)Session["Cart"]; } }
//Category Data Bind protected void CategoryBind() { using (var conn = new MySqlConnection(strcon)) { conn.Open(); using (var cmd = new MySqlCommand("SELECT * FROM Category", conn)) { using (var reader = cmd.ExecuteReader()) { if (reader.HasRows) { DropDownCategory.DataSource = reader; DropDownCategory.DataValueField = "CatId"; DropDownCategory.DataTextField = "CName"; DropDownCategory.DataBind(); DropDownCategory.Items.Insert(0, new ListItem("--- Choose One ---", "NA")); } } } } }
protected void Page_Load(object sender, EventArgs e) { string language = Session["mylang"].ToString(); check.LanguageCheck(language); base.InitializeCulture(); wfname = Request.QueryString["WfName"]; txtboxName.Text = wfname; txtboxName.Enabled = false; // Response.Write(language); if (language == "en-US") { c = 'e'; } else { c = 'f'; } if (!Page.IsPostBack) { //lbltxt.Text = "1st time"; DataTable dt_module = fill_module(c); DropDownModule.DataSource = dt_module; DropDownModule.DataTextField = "Str"; DropDownModule.DataValueField = "Id"; DropDownModule.DataBind(); DataTable dt_category = fill_category(c); DropDownCategory.DataSource = dt_category; DropDownCategory.DataTextField = "Str"; DropDownCategory.DataValueField = "Id"; DropDownCategory.DataBind(); WorkflowsService workflowsService = new WorkflowsService(); List <LoadWorkflowStepsDTO> wfsdto = workflowsService.LoadWorkflowStepsDTO(txtboxName.Text); if (wfsdto.Count > 0) { DataTable dtsteps = new DataTable(); dtsteps.Columns.Add("Str", typeof(string)); dtsteps.Columns.Add("Id", typeof(string)); foreach (LoadWorkflowStepsDTO wfs in wfsdto) { DataRow row = dtsteps.NewRow(); row["Id"] = wfs.step_Id; row["Str"] = wfs.step_Screen_Name; dtsteps.Rows.Add(row); } GridViewSteps.DataSource = dtsteps; GridViewSteps.DataBind(); GridViewSteps.Columns[2].Visible = false; ViewState["dtTable"] = dtsteps; } } }