//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;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 5
0
 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)
     {
     }
 }