473,395 Members | 1,652 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.

Populate foreign key in InsertTemplate of FormView

Hello all,

How would I populate a foreign key value in a label field of a FormView when
FormView changes mode to Insert? So that I can insert foreign key.

Explanation:
Suppose there are two tables in database, EMPLOYEE (list of employees) and
EMPLOYEE_DOCS (list of documents of every employee). table EMPLOYEE_DOCS
have a foreign key field EMPLOYEE_ID. When I use FormView's Insert mode for
EMPLOYEE_DOCS, I want to to explicitly take foreign key, so that it wont go
blank when inserting in database or user wont need to type it. I have
everything in Panels (webcontrol)

Thank you for help.
Miraj
Nov 19 '05 #1
1 1869
Thanks all, I figured out

I did this:

Protected Sub FormView1_ItemInserting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewInsertEventArgs) Handles
FormView1.ItemInserting

e.Values("EMPLOYEE_ID") =
GridView1.Rows(GridView1.SelectedIndex).Cells(1).T ext ' cells(1).text is the
foreign key

End Sub
"Miraj Haq" <mi******************@yahoo.com> wrote in message
news:ep**************@TK2MSFTNGP10.phx.gbl...
Hello all,

How would I populate a foreign key value in a label field of a FormView
when FormView changes mode to Insert? So that I can insert foreign key.

Explanation:
Suppose there are two tables in database, EMPLOYEE (list of employees) and
EMPLOYEE_DOCS (list of documents of every employee). table EMPLOYEE_DOCS
have a foreign key field EMPLOYEE_ID. When I use FormView's Insert mode
for EMPLOYEE_DOCS, I want to to explicitly take foreign key, so that it
wont go blank when inserting in database or user wont need to type it. I
have everything in Panels (webcontrol)

Thank you for help.
Miraj


Nov 19 '05 #2

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

Similar topics

0
by: Daves | last post by:
(using 2.0) I have a page for viewing products and each product is assigned to several categories. On this page I have a FormView and an AccessDataSource. The ItemTemplate shows the product...
0
by: Hawk | last post by:
Is it possibly to have the formview and or detail view be dynamic? I mean if there is a dropdownlist with a list of names from one table that will display details from an other table in a formview...
3
by: Richard Carpenter | last post by:
I understand how to use a dropdown list control to display the associated description value for a foreign key in a parent rather than the key itself, but I don't like having to disable the control...
0
by: jobs at webdos | last post by:
I have a formview that will either edit or insert records into a database. when I call the page with a query string ?x= its goes to edit mode and loads data from a datasource in the form and load...
3
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I get an error on a .net 2.0 page when I use foreign characters, such as ç or ã. Setting validateRequest=false handles this, but is there a way to keep validateRequest=true but allow foreign...
7
by: jthep | last post by:
Hi, I'm a newbie at this but how can I populate a table with data from other tables by using INSERT statements? Below is of what I have so far, I have to populate the PERSON_PROFILE table. I've...
0
by: nomee | last post by:
Nice day Everyone and Thanks in advance. I am working with Form View and everything is working fine. I just want to Put the "New" label (label that invokes the insert command) Outside the...
0
by: mkidd | last post by:
Hi, I'm trying to build an online form using asp.net and vb.net for the code behind in Visual Studio 2005. I want to fill 3 fields in a FormView that's connected to one table (table1) with...
5
by: =?Utf-8?B?U2F0aXNo?= | last post by:
C#, ASP.NET Q: Have a formview, with a dropdownlist which is bound to a column. This dropdownlist has a datasource of DataSet type. Now my objective is, on Selection Changed of this DropdownList,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.