Transfer, and saving to database

3 posts, 0 answers
  1. Derek
    Derek avatar
    118 posts
    Member since:
    Oct 2008

    Posted 21 Dec 2009 Link to this post

    I am trying to configure a pair of listboxes to allow transfer. The user interface side works, but no changes are written to the database. Here's the scenario;

    Three tables, Communications, Contacts, and CommunicationContacts. Each communication has zero or more contacts associated with it, defined as rows in the CommunicationContacts table. The CommunicationContacts table has three fields; primary key, CommunicationID and ContactID, with appropriate relational integrity. What I want to do is show two listboxes; one containing the names of the people who are selected (from the Contacts table, via a lookup), and a list of names of people who aren't selected. I have the logic of the queries, but what i want is when I add a name from the UNSELECTED to the SELECTED list, I want a row to be added to the CommunicationContacts table. Likewise when I remove a name from teh selected list, I want that row to be removed from the CommunicationContacts table.

    I have the page set up and working using object data sources, with update and delete actions defined, the transfers are appearing properly, but no db changes are recorded.

    Can anyone provide me with an example of a working page where two related listboxes are used and the changes are saved?

    Thanks in advance.
  2. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 21 Dec 2009 Link to this post

    This demo does shows and example of having two ListBoxes and saving changes to their sources. Since it uses AutomaticUpdates it might not be the best solution for you so you can always use the ListBox events and manually call the add/delete methods.
  3. DevCraft R3 2016 release webinar banner
  4. Genady Sergeev
    Genady Sergeev avatar
    1595 posts

    Posted 21 Dec 2009 Link to this post

    Hello Derek,

    Schulurk is right, you may not use the AutoUpdate functionality for such a complicated scenario. What you can do, is to hook on the Insert/Deleted events of the RadListBox and call the respective Insert/Delete methods of your Data Access Layer.

    Sincerely yours,
    Genady Sergeev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top