473,503 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

insert new record in detailsview - how to get master id

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
Jul 3 '06 #1
1 3687
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
Jul 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1206
by: fig000 | last post by:
Hi, I'm trying to use the sqldatasource control and a detailsview to create a fully functional data entry screen; it's quite easy. I can see the strength of creating a master grid associated...
0
1036
by: nsitnikov | last post by:
Hi, Here is the problem that I'm trying to solve. I have a DetailsView on the page, which is set to work in Edit Mode. On insert it adds a record to SQL Server 2000 database. Everything is working...
1
5934
by: needin4mation | last post by:
Not sure what I'm doing wrong here. I have a gridview and a detailsview. The detailsview is set to insert by default. When I insert data the detailsview it works. The data goes in the database....
1
3257
by: tcc.se7en | last post by:
Hi -- I have an ASP.NET web app that I just converted to use a Master Page for common content (banner and nav). I also just updated my version of the MS Ajax framework to the latest one (and had...
0
1231
by: tarscher | last post by:
Hi all, I use a detailsview to insert a record in a database. The detailsview is linked via a objectdatasource to an insert business object that expects an object (class I wrote myself. How can...
4
14998
by: Mark Olbert | last post by:
I am struggling with trying to retrieve the value of an autoincrement identity field after a DetailsView Insert operation. The DetailsView is bound to an SqlDataSource control. So far as I can...
0
4033
by: troydixon | last post by:
Hello, I am new at this, and have been trying to insert data into a table by using the footer of a gridview (which I dont like) or by using a detials view on the same page that is doing the...
5
3439
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration:...
3
2073
by: deneushasler | last post by:
Hello my name is Juan Jose. My problem is as follows. When I try to insert a record into a table (access) to control DetailsView Visual Web Developer 2005, when I run the page and insert a record...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5576
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4670
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1507
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
377
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.