public void LoadData(int ObjectID)
    {
        if (!Page.IsPostBack)
        {
            List <BSTerm> terms = BSTerm.GetTerms(TermType);
            if (terms.Count > 0)
            {
                cblCats.DataSource     = terms;
                cblCats.DataMember     = "TermID";
                cblCats.DataTextField  = "Name";
                cblCats.DataValueField = "TermID";
                cblCats.DataBind();
            }
            else
            {
                LiteralControl lC = new LiteralControl();
                lC.Text = Language.Admin["CategoryNotFound"] + "<br><br><a href=\"Categories.aspx?#Add\">" + Language.Admin["AddNewCategory"] + "</a>";
                divCats.Controls.Add(lC);
            }

            if (ObjectID != 0)
            {
                List <BSTerm> objectTerms = BSTerm.GetTermsByObjectID(ObjectID, TermType);
                foreach (BSTerm objectTerm in objectTerms)
                {
                    if (cblCats.Items.FindByValue(objectTerm.TermID.ToString()) != null)
                    {
                        cblCats.Items.FindByValue(objectTerm.TermID.ToString()).Selected = true;
                    }
                }
            }
        }
    }
Пример #2
0
    public void LoadTags(int ObjectID)
    {
        txtTags.Value = "";

        List <BSTerm> terms = BSTerm.GetTermsByObjectID(ObjectID, TermTypes.Tag);

        foreach (BSTerm term in terms)
        {
            string strText  = term.Name;
            string strValue = term.TermID.ToString();

            txtTags.Value += "{value='" + strValue + "',text='" + strText + "'}";
            sAutoComp.Items.Add(new ListItem(strText, strValue));
        }
    }
 public List <BSTerm> GetCategories()
 {
     return(BSTerm.GetTermsByObjectID(PostID, TermTypes.Category));
 }
 public List <BSTerm> GetTags()
 {
     return(BSTerm.GetTermsByObjectID(PostID, TermTypes.Tag));
 }