[thelist] .NET - using variable as form field value

Ed McCarroll Ed at ComSimplicity.com
Wed Aug 1 22:49:46 CDT 2007


> how do I get the value of the requesting form's field 'EmpID' and insert
> it into a hidden form field in the new page?

In the appropriate event handler, it would be something like:  (this one
crashes if EmpID doesn't hold something that looks like an integer)

  Dim intEmpID as integer = Cint(Me.txtEmpID.text)
  Me.hfEmpID.text = Cstr(intEmpID)

or, if you don't need the integer in your code-behind:

  Me.hfEmpID.text = Cstr(Cint(Me.txtEmpID.text))

or, more simply:  (disregarding validation issues completely)

  Me.hfEmpID.text = Me.txtEmpID.text

And, of course, the "Me." prefix can be implied

  hfEmpID.text = txtEmpID.text

Regards,
 
  Ed

"A person's true wealth is the good he or she does in the world."
(Mohammed) 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ed McCarroll                             http://www.ComSimplicity.com
H:(310) 838-4330                    PO Box 654, Culver City, CA 90232
C:(310) 904-3651                          MailTo:Ed at ComSimplicity.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -




More information about the thelist mailing list