?
Solved

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

Posted on 2006-06-15
6
Medium Priority
?
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 96

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Accepted Solution

by:
jrram earned 750 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 750 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

741 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