Reputation: 7649
I have a listbox which populated from using a datatable. I have a Add button in my page. On clicking the add button I want to insert a blank row in the listbox. This can be done easily by
ListBox_Admin.Items.Add("");
after this is done I want to select this item as in setfocus on this item.How do I do this.
Upvotes: 1
Views: 4566
Reputation: 2468
Try this
ListBox_Admin.Items.Add(item);
ListBox_Admin.SeletedItem = item;
Upvotes: 0
Reputation: 16651
Something like this?
listBox1.Items.Add("");
listBox1.SelectedIndex = listBox1.Items.Count - 1;
Upvotes: 3