Link to home
Start Free TrialLog in
Avatar of nmarun
nmarunFlag for India

asked on

One datasource to multiple controls

Hi people,
var albums = new AlbumCollection();
            ISortExpression SortOrder = new SortExpression(AlbumFields.Order | SortOperator.Ascending);
            //  read rows from database
            albums.GetMulti(null, int.MaxValue, SortOrder);
 
            // bind it to listbox1
            LatestAlbum1List.DataSource = albums;
            LatestAlbum1List.DisplayMember = "Name";
 
            // bind it to listbox2
            LatestAlbum2List.DataSource = albums;
            LatestAlbum2List.DisplayMember = "Name";
 
            // set SelectedIndex
            LatestAlbum1List.SelectedIndex = 12;
            // when I do this, even LatestAlbum2List 
            // also changes the SelectedIndex to 12
            // why does this happen and how do I break this association?

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of nmarun
nmarun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial