I have list box(lstcategories) .. filled with items coming from database by using the below code …
private void getcategorynames()
{
var categorytypes = (from categories in age.categories
select categories.category_Name).ToList();
foreach (string item in categorytypes)
{
listcategories.Items.Add(item);
}
my problem is if i click on the item in list box i need to do something.. like that
if i click on the category name(list box item) i need to pass the selected category name to the database
can any one pls help on this…
ListBox.Items is a collection of objects, so you can store the category object itself instead of the string representation of it.
Then in ListBox.SelectedIndexChanged
If you want to do it all inline