Update db Only

2 posts, 0 answers
  1. Ingrid Williams
    Ingrid Williams avatar
    2 posts
    Member since:
    Apr 2010

    Posted 26 Apr 2012 Link to this post

    Is there a way to perform only an update to a database table (no insert or delete)  when listbox item is transferred from a souce radlistbox to a destination listbox.  Please supply some code in VB if possible.

    Thank you
  2. Bozhidar
    Bozhidar avatar
    1096 posts

    Posted 01 May 2012 Link to this post

    Hi Ingrid,

    The action which is performed on the database when you transfer an item is determined by the InsertCommand that you've set on the destination listbox's datasource (and DeleteCommand on the first one, if the transfer mode is set to move). So if you want to do an update, all you have to do is set an update query to these commands. Here's a small example:
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"
        ConnectionString="<%$ ConnectionStrings:Area2ConnectionString %>"
        SelectCommand="SELECT * FROM [Areas]"
        InsertCommand="UPDATE [Areas] SET [update_user] = @update_user, [contactID] = @contactID WHERE [id] = @id">
            <asp:Parameter Name="id" Type="Int32" />
            <asp:Parameter Name="update_user" Type="String" />
            <asp:Parameter Name="contactID" Type="Int32" />

    If you want to learn more about the ListBox's automatic database update mechanism, you can refer to the following help article:
    All the best,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top