Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Default value for insert parameter

Posted on 2006-03-29
4
Medium Priority
?
1,194 Views
Last Modified: 2008-01-09
Hi,

I have two detailsview on a single page, DetailsView1 and DetailsView2.

DetailsView1 is based on a recordset as follows:

tblApplication
----------------
ApplicantID (PK)
ApplicationName


DetailsView2 is based on a recordset as follows:

tblApplicationNote
-------------------
ApplicationNoteID (PK)
ApplicantID (FK from tblApplication)
NoteDetails
NoteDate


Now, I would like to insert a new record into tblAppllicationNote using DetailsView2, and I have assigned the parameters as follows:
           
<InsertParameters>
                <asp:Parameter Name="ApplicantID" Type="Int32" DefaultValue="2" />
                <asp:Parameter Name="NoteDetails" Type="String" />
                <asp:Parameter Name="NoteDate" Type="DateTime" />
</InsertParameters>


As you can see, I have assigned a default value of "2" for ApplicantID to test that the insert command works, which it does.

However, I would like to set the default value of ApplicantID to be the currentvalue of DetailsView1; i.e. as we page through the recordset in DetailsView1, then inserting a note in DetailsView2 will happen correctly.

Thanks for any help that you can provide.
0
Comment
Question by:JonoBB
3 Comments
 
LVL 8

Author Comment

by:JonoBB
ID: 16320822
I seem to be answering these faster than anyone else...

Change
                <asp:Parameter Name="ApplicantID" Type="Int32" DefaultValue="2" />

To

                <asp:ControlParameter ControlID="FormView1" Name="ApplicantID" PropertyName="SelectedValue"
                    Type="Int32" />
0
 
LVL 22

Expert Comment

by:Jason Scolaro
ID: 16322371
Hi JonoBB,

Please, when you get a chance, close this question.  

To do so, post a zero-point question in http://www.experts-exchange.com/Community_Support/

Subject: Moderator Please PAQ
Body: Please PAQ this question, I answered it myself
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_21793362.html

Thank you!

-- Jason
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16353471
Closed, 500 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question