protected void BookmarkItem(object sender, EventArgs args) { if (!String.IsNullOrEmpty(CategoryText)) { foreach (DataGridViewRow row in dgvSignals.SelectedRows) { CreateCarrierIfReceiver("RSSFeedBookmark", signal => { signal.BookmarkCategory.Category.Text.Value = CategoryText; if (!String.IsNullOrEmpty(BookmarkNote)) { signal.BookmarkNote.Note.Text.Value = BookmarkNote; } signal.RSSFeedUrl.Url.Value = row.Cells[urlColumnName].Value.ToString(); }, false); } // Update to combobox last. cbCategories.DataSource = null; string txt = CategoryText; Categories.AddIfUnique(txt); Categories.Sort(); cbCategories.DataSource = Categories; cbCategories.SelectedItem = txt; } else { MessageBox.Show("Please select or create a category.", "Action Required", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
protected void UpdateCategoryList(dynamic signal) { if (Categories.AddIfUnique((string)signal.Category.Text.Value)) { cbCategories.DataSource = null; // reset cbCategories.DataSource = Categories; } }