Can not get selectedindex with Listbox in VB.NET 2008
I cl开发者_高级运维ick on items in my listbox and then hit a submit button, but when istep through my button_clicked code it doesn't detect any selectedindex. All controls are in the same form and there are no panels. Why can't I detect what items were clicked on in the listbox? Thanks!
What about your page load? Maybe you load your listbox in page load and so every time you click the button it loads items again.
Probably you aren't checking if it is a postback. Only load the listbox if it isn't postback.
Onload(EventArgs e)
{
If(!IsPostBack)
{
//Your code here...
精彩评论