insert new record in detailsview - how to get master id

Discussion in 'ASP .Net' started by =?Utf-8?B?SmF5RA==?=, Jul 3, 2006.

  1. Here is the problem:

    Using asp.net 2.0 to create a web app with standard master table gridview
    and child detailsview with insert capability.
    SQL Server 2000 database on the backend. Using Visual Web Developer for
    front-end development.

    I want to insert new records in detailsview based on selected gridview
    record. All the fields in "INSERT" mode are blank, which is okay EXCEPT that
    I want the child ID to be that of the selected gridview record. For example,
    to put a new order for customer with customerID 367, I need 367 to be
    inserted in the new Orders record.

    This is a very standard database and application design problem, but can't
    seem to get a solution for it.

    Please help if you can

    Best -

    jayd
     
    =?Utf-8?B?SmF5RA==?=, Jul 3, 2006
    #1
    1. Advertising

  2. Can anyone answer this one? I am facing the same scenario. When I click
    Insert on my child formview control, I get an error stating that it
    cannot insert null into the parent key field in the child table. Where
    do I make the connection between the parent formview data and the child
    formview data?

    I have the datasource for the child formview configured to use the
    parent formview control for it's where clause expression, and, where
    child records already exist, it works fine, but I can't get it to
    insert a new record successfully in either case.

    Rich


    JayD wrote:
    > Here is the problem:
    >
    > Using asp.net 2.0 to create a web app with standard master table gridview
    > and child detailsview with insert capability.
    > SQL Server 2000 database on the backend. Using Visual Web Developer for
    > front-end development.
    >
    > I want to insert new records in detailsview based on selected gridview
    > record. All the fields in "INSERT" mode are blank, which is okay EXCEPT that
    > I want the child ID to be that of the selected gridview record. For example,
    > to put a new order for customer with customerID 367, I need 367 to be
    > inserted in the new Orders record.
    >
    > This is a very standard database and application design problem, but can't
    > seem to get a solution for it.
    >
    > Please help if you can
    >
    > Best -
    >
    > jayd
     
    Richard Carpenter, Jul 10, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. deneushasler
    Replies:
    3
    Views:
    411
    deneushasler
    Jul 3, 2008
  2. MU
    Replies:
    1
    Views:
    1,208
    Paul Shapiro
    Jan 26, 2009
  3. Hanno

    Make new record current in DetailsView after Insert

    Hanno, Aug 5, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    197
    Hanno
    Aug 5, 2006
  4. Frits van Soldt

    How to insert a new record in detailsview when there are no record

    Frits van Soldt, Nov 16, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    749
    Frits van Soldt
    Nov 17, 2005
  5. Feege
    Replies:
    0
    Views:
    468
    Feege
    Dec 20, 2005
Loading...

Share This Page