Exemplo n.º 1
0
 //添加分类信息
 protected void btnAddType_Click(object sender, EventArgs e)
 {
     if (btnAddType.Text.ToString() == "新增")
     {
         this.btnAddType.Text = "添加";
         this.txtSort.Visible = true;
         this.btnNo.Visible   = true;
     }
     else
     {
         SortInfo sort = new SortInfo();
         if (txtSort.Text.ToString() != "")
         {
             sort.Sortname = this.txtSort.Text.ToString();
             int count = SortInfoManager.addSortInfo(sort);
             if (count > 0)
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "key", "alert('添加成功!')", true);
                 binddropdown();
                 this.txtSort.Visible = false;
                 this.btnAddType.Text = "新增";
                 this.btnNo.Visible   = false;
             }
             else
             {
             }
         }
     }
 }
Exemplo n.º 2
0
        //绑定公告分类
        protected void binddropdown()
        {
            this.ddlSor.Items.Clear();
            IList <SortInfo> sortlist = SortInfoManager.getSortInfoAll();

            foreach (var item in sortlist)
            {
                ListItem list = new ListItem(item.Sortname, item.Sortid.ToString());
                this.ddlSor.Items.Add(list);
            }
            ListItem ltem = new ListItem("选择类型", "-1"); //添加第一行默认值

            this.ddlSor.Items.Insert(0, ltem);          //添加第一行默认值
        }