Thursday, March 22, 2012

Trouble with Request.Form- output is blank

Hey all,

I'm very much new to ASP and ASP.net, and I'm having difficulties in figuring out to get ASP.net to properly output the value of a form field in a vb script. The field in particular is one that contains a two-letter abbreviation of a state (E.g. if the visitor selected California, the value of the field would be CA). This normally works fine, but when a visitor selects Indiana, that's where ASP.net returns nothing. I can see that ASP.net recognizes IN as VB code, I'm just not sure how to force it to just print IN.

Here's a snippet of the code:


obj.OrigZipPostal = Request.Form("vendorpostal" & i)
obj.OrigStateProvince = Request.Form("vendorstate" & i)

Thanks for helping a newbie out :D

You need to convince vb.net that you are using a string and not a command, you could try CStr() or use quotes...

Hope that this helps.


Use

obj.OrigStateProvince = CStr(Request.Form("vendorstate" & i))

Thanks


Thanks guys, that solved the problem.

0 comments:

Post a Comment