void PopulateTags() { _tagList.Items.Clear(); AWAPI_BusinessLibrary.library.TagLibrary tagLib = new AWAPI_BusinessLibrary.library.TagLibrary(); var list = tagLib.GetList(App_Code.SessionInfo.CurrentSite.siteId, ""); if (list == null) { return; } foreach (awSiteTag tag in list) { ListItem itm = new ListItem(); itm.Value = tag.siteTagId.ToString(); itm.Text = tag.title; itm.Attributes.Add("name", "tagitem"); itm.Attributes.Add("tag", tag.title); //function setElementFromCheckBoxList (spanName, listId, targetId) itm.Attributes.Add("onclick", "setElementFromCheckBoxList('tagitem', '" + _tagList.ClientID + "', '" + _contentTags.ClientID + "')"); _tagList.Items.Add(itm); } }
void SaveContentsTags(long contentId) { AWAPI_BusinessLibrary.library.TagLibrary tagLib = new AWAPI_BusinessLibrary.library.TagLibrary(); //delete the current ones tagLib.DeleteTaggedContentByContentId(contentId); //add foreach (ListItem li in _tagList.Items) { if (li.Selected) { tagLib.TagContent(Convert.ToInt64(li.Value), contentId); } } }
void PopulateContentsTags(long contentId) { _contentTags.Text = ""; AWAPI_BusinessLibrary.library.TagLibrary tagLib = new AWAPI_BusinessLibrary.library.TagLibrary(); var tags = tagLib.GetContentTagList(contentId); foreach (awSiteTag tag in tags) { ListItem li = _tagList.Items.FindByValue(tag.siteTagId.ToString()); if (li != null) { li.Selected = true; _contentTags.Text += li.Text + ";"; } } }