FormView - how to insert data into a hidden field??

A

adam.waterfield

I am pretty sure this is a simple problem, with a simple solution, but
I am totally lost with this. I am working to a very tight uni
deadline, and have wasted far too long on this now, so any help would
be much appreciated.

I have a FormView with various textboxes in it and some hidden fields.
I also have a command button. What I basically want to happen, is
when the command button is pressed is the script send some values back
to the hidden fields in FormView1. How do you do this? I have no
problems in getting this to work with labels outside the FormView?

Below is my code from the button.

ivfBookingNo, ivfBookingDate and ivfBookingDate are the fields I am
trying to populate. I have tried it in various ways, such as
FormView1.ivfBookingNo etc...

Please ignore my non-standard naming conventions :)

Thanks!


Protected Sub book_Click(ByVal sender As Object, ByVal e As
System.EventArgs)

Dim bookingNo As String

Dim bookingTime As String

Dim bookingDate As String

Dim bookingSec As String

Dim strHash As String
bookingTime = Now.ToLongTimeString

bookingDate = Now.Date

bookingSec = Now.Millisecond

strHash = bookingSec + bookingTime + bookingDate

bookingNo =
FormsAuthentication.HashPasswordForStoringInConfigFile(strHash,

"md5")
lblBookingMade.Text =

"Booking Confirmation"
lblBookingRef.Text =

"Your Booking Ref: " + bookingNo
ivfBookingNo.value = bookingNo

ivfBookingTime.value = bookingTime

ivfBookingDate.value = bookingDate


End Sub
 
K

Kees de Winter

Have you tried something like
CType(FormView1.FindControl("ivfBookingNo), "HiddenField").value = bookingNo
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top