Solved

I can't read two parameters from a querystring!!

Posted on 2006-06-15
6
251 Views
Last Modified: 2008-02-26
Hi Guys,
I have an hyperlink in a datagrid that calls the MainFrame page with two parameters like this

http://localhost/InsertVouchers/MainFrameVP.aspx?VVoucherNum=12341234075380&VMod=VP

In the page_Load I'm receiving the parameters with
string VVoucher = Request.QueryString["VVoucherNum"];      
string VOption = Request.QueryString["VMod"];      

The problem is that VOption doesn't have any information it's null but I can see that in the URL the parameter VMod has information. What could be happening???
Help Please !!!!
Thanks
Carol




0
Comment
Question by:Carolinat
6 Comments
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 16913246
Is this ASP or ASP.NET?
0
 
LVL 6

Expert Comment

by:inviser
ID: 16913600
if this is asp then it needs to look like this. ASP does not support variable type binding (e.g. strings, ints, etc.). All variables are generic in type. Also, the request.queryString method uses ( ) instead of [ ].

dim VVoucher, VOption

VVoucher = Request.QueryString("VVoucherNum")  
VOption = Request.QueryString("VMod")    
0
 
LVL 6

Expert Comment

by:inviser
ID: 16913639
After the fact I realize your page is probably ASP.NET because of the .aspx extension in the URL you posted. In that case, it would look like this:

Dim VVoucher As String = Request.QueryString("VVoucherNum")  
Dim VOption As String = Request.QueryString("VMod")    
0
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.

 
LVL 13

Accepted Solution

by:
jrram earned 250 total points
ID: 16913756
>> inviser

It looks like she is coding in C# if it makes a difference.

>>  Carolinat

a. Are you getting a value back from your first parameter?
b. Have you tried reading the 2nd parameter first to see if it makes a difference.
c. Try this and see if it works
    string VOption = Request.QueryString.GetValues("VMod")[0];
0
 
LVL 12

Assisted Solution

by:ullfindsmit
ullfindsmit earned 250 total points
ID: 16914197
not an expert @ C# but try this


string VVoucher = (String) Request.QueryString["VVoucherNum"];    
string VOption = (String) Request.QueryString["VMod"];  

basically teh request.querystring returns an object

also try this
string VVoucher = (String) Request["VVoucherNum"];    
string VOption = (String) Request["VMod"];  

hope this helps

0
 

Author Comment

by:Carolinat
ID: 16922801
Guys, I'm developing with ASP and c#.

jrram

a. Are you getting a value back from your first parameter? ****yes
b. Have you tried reading the 2nd parameter first to see if it makes a difference.** Yes, I did it and still doesn't show anything in the variable VMod.
c. Try this and see if it works
    string VOption = Request.QueryString.GetValues("VMod")[0];
    ***It shows an error

 ullfindsmit
string VVoucher = (String) Request["VVoucherNum"];    
string VOption = (String) Request["VMod"];  
** I tried both options and neither one works

Any other idea????
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

821 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