• 学习笔记找到多个具有相同ID“_header”的控件,FindControl要求控件具有唯一的ID.


    private void DisplayHotBooks()
        {
            //获取所有的书分类信息
            IList<Category> list = CategoryManager.GetAllCategories();
            int i = 0;
            foreach (Category item in list)
            {
                AccordionPane ap = new AccordionPane();
                Label lbMenu = new Label();
                lbMenu.Text = item.Name;
                ap.HeaderContainer.Controls.Add(lbMenu);
                Accordion1.Panes.Add(ap);
            }
        }

    从异常"_header"可以猜测到与pane的header有关;于是手动添加不重复id

        private void DisplayHotBooks()
        {
            //获取所有的书分类信息
            IList<Category> list = CategoryManager.GetAllCategories();
            int i = 0;
            foreach (Category item in list)
            {
                AccordionPane ap = new AccordionPane();
                Label lbMenu = new Label();
                lbMenu.Text = item.Name;
                ap.HeaderContainer.Controls.Add(lbMenu);
                ap.HeaderContainer.ID = "_header" + item.Id;
                Accordion1.Panes.Add(ap);
            }
        }

    接着抛出异常 找到多个具有相同 ID“_content”的控件。FindControl 要求控件具有唯一的 ID。呵呵,差点忘了pane除了header还有content,于是再手动添加content id;最终如下:

        private void DisplayHotBooks()
        {
            //获取所有的书分类信息
            IList<Category> list = CategoryManager.GetAllCategories();
            int i = 0;
            foreach (Category item in list)
            {
                AccordionPane ap = new AccordionPane();
                Label lbMenu = new Label();
                lbMenu.Text = item.Name;
                ap.HeaderContainer.Controls.Add(lbMenu);
                ap.HeaderContainer.ID = "_header" + item.Id;
                ap.ContentContainer.ID = "_content" + item.Id;
                Accordion1.Panes.Add(ap);
            }
        }

  • 相关阅读:
    (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated UXXXXXXXX escape 错误
    Pandas_key_point
    鲁棒性、稳定性、非脆弱性
    防止过拟合的处理方法
    Python中的random模块
    Python reload(sys)找不到,name 'reload' is not defined
    sigmoid 和 soft-max总结
    2.7 Structured Regression Models
    2.x ESL第二章习题2.4
    2.6. Statistical Models, Supervised Learning and Function Approximation
  • 原文地址:https://www.cnblogs.com/chengcailian/p/3872601.html
Copyright © 2020-2023  润新知