protected void AddStudent_Click(object sender, EventArgs e) { if (!TagSelectionCB.SelectedValue.Equals(String.Empty) && !GroupIds.Contains(Convert.ToInt32(TagSelectionCB.SelectedValue))) { TagListField.Value += (TagListField.Value.Length > 0 ? "," : "") + TagSelectionCB.SelectedValue; } LoadTable(); TagSelectionCB.ClearSelection(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { using (WebhostEntities db = new WebhostEntities()) { TagSelectionCB.DataSource = db.WebPageTags.ToList(); TagSelectionCB.DataTextField = "Name"; TagSelectionCB.DataValueField = "id"; TagSelectionCB.DataBind(); RemoveList.DataSource = db.WebPageTags.Where(p => GroupIds.Contains(p.id)).ToList(); RemoveList.DataTextField = "Name"; RemoveList.DataValueField = "id"; RemoveList.DataBind(); } } LoadTable(); }