Friday 1 April 2011

Selected Values for Multiple ListBox

Simple little one in both vb.net and C# When you have a Multiple Selection Listbox whether it is static or dynamic and you wish to have previous entered data for a view page to be selected it is imperative that you enter the code for each selection as follows:

in vb.net

lb_cause.Items(1).Selected = True

where 1 is the value for the list item in the listbox

and c#

lb_cause.Items[1].Selected = True;

Never, ever use lb_cause.

SelectedValue = 1

Thats all for now.

No comments:

Post a Comment