2
Reply

Keeping selected item focused in listbox after postback

Sreenath G

Sreenath G

Jun 23 2011 8:07 AM
6.1k
 

I have a listbox with items been filled during runtime. Here how can I keep focus on the selected items in the listbox after postback. I have set multiple selection for the listbox.

 

I don't want use coding like this to keep focus every time

 

int lIntOldIndes = ListBox1.SelectedIndex;

                ListBox1.Focus();

                ListBox1.SelectedIndex = lIntOldIndes;

 

Any suggestions please.

 

Thanks

Sreenath


Answers (2)