Esempio n. 1
0
 protected void GetSubCategoryDropDownList(int subcatid)
 {
     Categories = NCRClass.NCRController.LookupAllCategoriesByParentId(subcatid);
     SubCategoryDDL.DataSource     = Categories.Tables["Categories"];
     SubCategoryDDL.DataTextField  = "CategoryName";
     SubCategoryDDL.DataValueField = "OCID";
     SubCategoryDDL.DataBind();
 }
Esempio n. 2
0
        protected void CategoryDDL_SelectedIndexChanged(object sender, EventArgs e)
        {
            //where parent id =
            //get subcategories for spec parentid
            //get all info for specific category
            //when i reselect from parent dropdown, the subdropdown should populate. but doesnt.

            int.TryParse(CategoryDDL.SelectedValue.ToString(), out parentId);
            if (parentId != 0)
            {
                try
                {
                    MessageLBL.Text               = parentId.ToString();
                    Category                      = NCRClass.NCRController.LookupCategoryName(parentId);
                    CatName.Text                  = Category.Tables["Category"].Rows[0]["CategoryName"].ToString();
                    Category                      = NCRClass.NCRController.LookupAllCategoriesByParentId(parentId);
                    SubCategoryDDL.DataSource     = Category.Tables["Categories"];
                    SubCategoryDDL.DataTextField  = "CategoryName";
                    SubCategoryDDL.DataValueField = "OCID";
                    SubCategoryDDL.DataBind();
                    SubCategoryDDL.Items.Insert(0, " ");
                    //here we display the addsubcat button
                    AddNewSub.Visible = true;
                    AddNewSub.Enabled = true;
                    EditCat.Enabled   = true;
                    AddNewCat.Enabled = true;
                    SaveCat.Enabled   = false;
                    DeleteCat.Enabled = false;
                    //all textbox Items are Disabled
                    // DisableTextboxes();
                }
                catch (Exception ex)
                {
                    MessageLBL.Text = "There is no record for that Category." + ex.Message.ToString();
                }
            }
            else
            {
                SubCategoryDDL.SelectedIndex = 0;
                MessageLBL.Text   = "You must either select a Category or click the add Button to add a new Engineer.";
                AddNewCat.Enabled = true;
                EditCat.Enabled   = false;
            }
            MessageLBL.Text = CategoryDDL.SelectedValue.ToString();
        }