Solved

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

Posted on 2006-06-15
6
250 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

772 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