Declarative arguments passing between DetailsViews

Last post 05-13-2007 3:50 PM by andremi. 0 replies.

Sort Posts:

  • Declarative arguments passing between DetailsViews

    05-13-2007, 3:50 PM
    • Loading...
    • andremi
    • Joined on 05-13-2007, 3:38 PM
    • Posts 1

    Hi,
    I have one SQL table Order and N SQL tables of OrderType shown in simplified form as follows:
     
    CREATE TABLE Order
    (
                order_id                       INTEGER IDENTITY(1,1)
                Name                           VARCHAR(32)
    )

     

    CREATE TABLE OrderType1
    (
                Id                                 INTEGER IDENTITY(1,1)
               order_id                        INTEGER REFERENCES Order(order_id)      
    Data1                           VARCHAR(32)
                …..
    )

    CREATE TABLE OrderType2
    (
                Id                                 INTEGER IDENTITY(1,1)
               order_id                        INTEGER REFERENCES Order(order_id)      
    Data2                           VARCHAR(32)
                …..
    )

    CREATE TABLE OrderTypeN..

    On the aspx page I have DetailsViewOrder, and corresponding DetailsViewOrderTypeX displayed on 2 steps of the wizard.

    Right now I have "manual" databinding -- I intercept "On_Next"  of wizard , create OrderTableAdapter, call Insert(name) on it with argument retrieved from the Name text field, get new order_id back, then create corresponding OrderTableAdapterX adapter and call Insert(order_id, dataX)

    Is there a way to do it in declarative way where somehow an "insert" would be forced on DetailsViewOrder which would return a new order_id back, which would force an "insert" on DetailsViewOrderTypeX and order_id would be passed from one DetailsViewOrder to another DetailsViewOrderTypeX?

    I am interested in this approach because I'd like to reuse DetailsViewOrderTypeX in "readonly" view state as UserControls on some other pages and re-laying out UI for all these N DetailsViewOrderType seems like a duplication of effort. Additionally declarative way would allow me to have far less code without a need to manually create table adapters.

    Alternatively, I would like to know if there are better suggestions to solve the problem of transacted addition of data across multiple tables in the database and whether I can use DetailsView to help with this, or should I just have stored procedure that modifies DB appropriately and hand-roll the ASP pages with textboxes and without the help of DetailsView?

     Thanks!

     -- Andrey

Page 1 of 1 (1 items)
Microsoft Communities
Page view counter