Solved

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

Posted on 2006-06-15
6
247 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
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/…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now