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; } } } } }
protected void Page_Load(object sender, EventArgs e) { GenerateHeaderButtons(); if (!Page.IsPostBack) { HideAll(); ddlParentCategory.DataTextField = "Name"; ddlParentCategory.DataValueField = "TermID"; ddlParentCategory.DataSource = BSTerm.GetTerms(TermTypes.Category); ddlParentCategory.DataBind(); string TermID = Request.QueryString["TermID"]; int iTermID = 0; int.TryParse(TermID, out iTermID); if (iTermID > 0) { divEditTerm.Visible = true; divSideEditTerm.Visible = true; BSTerm bsTerm = BSTerm.GetTerm(iTermID); if (bsTerm != null) { txtCatName.Text = bsTerm.Name; txtCatDescription.Text = bsTerm.Description; } else { Response.Redirect("Links.aspx"); } } else { divPosts.Visible = true; divAddTerm.Visible = true; gvItems.DataBind(); } } }
protected void gvItems_DataBinding(object sender, EventArgs e) { ((GridView)sender).DataSource = BSTerm.GetTerms(TermTypes.Tag); }