473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Formview Inserting new detail record - DataKey field ID not avail

All,
I have a form view that allows edit (updates) and Inserts (Add a new detail
row) .
THe formview is populated via a SqlDatasource that is fitered by value that
is passed to the SqlDatasource Filter expression.

When try to add a new detail record for the ID passed to the Filter
Expression I am not able to get it initial ID value (which is the DataKey for
the FormView).
For example CustomerID say 123 has three orders now I want to add a new
order to CustomerID 123.

In insert mode all the filed Textboxes are empty (as they should be) but
even the CustomerID field, even though it is bound to CustomerID when the
form first loads.
Currently I keeping the currentily selected CustomerID in a ViewState field
to reference it later when doing the insert (an insert into the Orders table
where I need to have a the CustomerID)
There must be an eaiser way to do this than use the ViewState.

This works fine for updates the CustomerID is avialble in the field in the
Update mode.

Does anyone know a way to get the CustomerID and populate it to the
CustomerID field in Insert mode hence be able to pass it along as the
CustomerID insert parameter.

Any help is appreciated.
Jawahar
Mar 12 '06 #1
0 1490

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

Similar topics

0
by: Zarn Bou via DotNetMonster.com | last post by:
Hi, I am creating a site that uses a master/detail type structure, where I am using the Gridview to display the master records, and when the user selects one of these I display all the details for...
1
by: Shawn Wildermuth | last post by:
I have a *single* SqlDataSource that loads up a single result set that I show in a GridView. In the GridView, i've added a "Select" button and handling the SelectedItem event. I also have a...
1
by: yuchang | last post by:
Hi, Using the FormView control is very efficient. But I want to do some action,like showing a success message or redirect to another page, after inserting, updating and deleting. How do I get...
4
by: Rob | last post by:
Hey all, So.. a simple FormView/SqlDataSource to handle inserting records into a table. The table has a primary key that the user enters (eg DiscountCode). If the user enters a duplicate the...
0
by: Q. John Chen | last post by:
I have a GridView and a FormView serve as master/detail relation. The GridView has paging enabled - 10 rows/page. The formView is linked to gridView's SelectedValue as the sole parameter. ...
0
by: hardieca | last post by:
Hi, My formview or gridview control stops updating or deleting a record once the record has a null value. I have table tblTest with the following pkID int NOT NULL **IDENTITY COLUMN**...
0
by: LiamLiamLiam | last post by:
G'day all. I having a problem with my formview. I'll ty to explain my situation as best as i can. I have a page with a search field at the top which is just a simple asp:textbox. Below that i...
1
by: andy | last post by:
I have several forms with formviewa on them. When a new record is inserted the users want to see the readonly version of that record. Default behaviour is to show the first record in the...
0
by: DesCF | last post by:
If I set the DataKeyNames property of a FormView control, for example: MyFormView.DataKeyNames = New String() {"CustomerID"} I can retrieve the current FormView Page CustomerID value using: ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.