Suppose I have a database with a many-to-many relationship, such as that between a table of patients and a table of diagnoses. diagnoses. There is a join table that contains only keys.
When my app opens, I want to populate a listbox (multi-select) with the diagnoses that are currently stored in the database for that particular patient. Then, the user should be allowed to update the listbox, clearing any diagnoses that are no longer valid
and selecting any new ones. These changes then need to be persisted back to the database.
How do I achieve this in Visual Studio? I'm rather new to the platform, so I would really appreciate some help with this (or examples).
mn1247
Member
2 Points
22 Posts
Using a listbox for many-to-many
Apr 02, 2012 04:33 PM|LINK
Suppose I have a database with a many-to-many relationship, such as that between a table of patients and a table of diagnoses. diagnoses. There is a join table that contains only keys.
When my app opens, I want to populate a listbox (multi-select) with the diagnoses that are currently stored in the database for that particular patient. Then, the user should be allowed to update the listbox, clearing any diagnoses that are no longer valid and selecting any new ones. These changes then need to be persisted back to the database.
How do I achieve this in Visual Studio? I'm rather new to the platform, so I would really appreciate some help with this (or examples).
Thanks,
Eric
Dino He - MS...
Star
8068 Points
1023 Posts
Microsoft
Re: Using a listbox for many-to-many
Apr 05, 2012 01:26 AM|LINK
Hi
You can use gridview and checkbox to do the multiple rows delete.
1. get all the datatable to gridview.
2. use the javascipt to get the checkbox select rows.
3. get the result at server side then do the update.
Here is a example:
http://www.codeproject.com/Articles/11207/Selecting-multiple-checkboxes-inside-a-GridView-co
Hope it helpful.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework