//Database connection for Category information to bind it to the Category Dropdownlist
 protected void CategoryBind()
 {
     using (var conn = new MySqlConnection(strcon))
     {
         conn.Open();
         string Query = "SELECT * FROM Category";
         using (var cmd = new MySqlCommand(Query, conn))
         {
             using (var reader = cmd.ExecuteReader())
             {
                 if (reader.HasRows)
                 {
                     CategoryDDL.DataSource     = reader;
                     CategoryDDL.DataValueField = "CatId";
                     CategoryDDL.DataTextField  = "CName";
                     CategoryDDL.DataBind();
                     if (CatIDTB.Text == "")
                     {
                         CategoryDDL.Items.Insert(0, new ListItem("--- Choose One ---", "NA"));
                     }
                     else
                     {
                         CategoryDDL.Items.FindByText(reader.GetString(reader.GetOrdinal("CName"))).Selected = true;
                     }
                 }
             }
         }
     }
 }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         PromoGridView.DataSource = BusinessLogic.Promos();
         PromoGridView.DataBind();
         DiscountGridView.DataSource = BusinessLogic.CDiscount();
         DiscountGridView.DataBind();
         CategoryDDL.DataSource     = BusinessLogic.Cats();
         CategoryDDL.DataTextField  = "Name";
         CategoryDDL.DataValueField = "CategoryID";
         CategoryDDL.DataBind();
     }
 }
示例#3
0
 protected void CategoryDDL_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (CategoryDDL.SelectedIndex == 0)
     {
         ProductDDL.SelectedIndex = 0;
         //ProductDDL.Enabled = false;
         CategoryDDL.DataBind();
         ProductDDL.DataBind();
     }
     else
     {
         ProductDDL.Enabled = true;
     }
 }
示例#4
0
 protected void GetCategoryDropDownList(int parentId)
 {
     Categories                 = NCRClass.NCRController.LookupAllCategoriesByParentId(parentId);
     CategoryDDL.DataSource     = Categories.Tables["Categories"];
     CategoryDDL.DataTextField  = "CategoryName";
     CategoryDDL.DataValueField = "OCID";
     CategoryDDL.DataBind();
     if (parentId == 0)
     {
         SubCategoryDDL.Items.Clear();
         SubCatName.Visible = false;
         AddNewSub.Visible  = false;
     }
     if (parentId != 0)
     {
         AddNewSub.Visible = true;
     }
 }
 private void DisplayCatgeory()
 {
     try
     {
         _cb._Top      = 1;
         _cb._PageSize = 1000;
         _cb._Flag     = "C";
         _cb.Execute("SelectAllCategoryCapability");
         if (_cb.Success != null)
         {
             CategoryDDL.DataSource     = (DataTable)_cb.Success;
             CategoryDDL.DataTextField  = "Name";
             CategoryDDL.DataValueField = "Id";
             CategoryDDL.DataBind();
         }
     }
     catch (Exception)
     {
     }
 }