Пример #1
0
        private void PopulateCategories()
        {
            List <string> categories = ToDoItemData.GetCategories();

            Category.DataSource = categories;
            Category.DataBind();
        }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         // Bind Categories list to CategoriesDropDown and set the initial selected value
         List <string> categoriesList = ToDoItemData.GetCategories();
         categoriesList.Add("ALL");
         CategoryDropDown.DataSource = categoriesList;
         CategoryDropDown.DataBind();
         int currentCategoryIndex = categoriesList.IndexOf(CategoryFilter);
         CategoryDropDown.SelectedIndex = currentCategoryIndex;
     }
 }