473,396 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Querystring empty

How do you check to see if there is no query string?

I could have:
1) file.aspx
2) file.aspx?r=5&st=joe

I need to know when there is no query string at all (1).

Thanks,

Tom
Feb 15 '06 #1
8 1622
IF (Request.QueryString("yourQueryString") Is Nothing) Then

END IF

Or

if(Request.QueryString("yourQueryString") == null)
{

}

Cheers,
Adam

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...
How do you check to see if there is no query string?

I could have:
1) file.aspx
2) file.aspx?r=5&st=joe

I need to know when there is no query string at all (1).

Thanks,

Tom

Feb 15 '06 #2
I don't understand.

I am not checking if there is a particular parameter there. I want to know
if the URL has 0 parameters (file.aspx). file.aspx?r=1 has 1 parameter and
file.aspx?r=1&st=joe has 2 parameters.

I want to be able to special processing if there is no parameters passed at
all. I don't want to check if r is nothing and st is nothing.

Thanks,

Tom
"Mr Ideas Man" <ad**@pertrain.com.au> wrote in message
news:Ob**************@TK2MSFTNGP11.phx.gbl...
IF (Request.QueryString("yourQueryString") Is Nothing) Then

END IF

Or

if(Request.QueryString("yourQueryString") == null)
{

}

Cheers,
Adam

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...
How do you check to see if there is no query string?

I could have:
1) file.aspx
2) file.aspx?r=5&st=joe

I need to know when there is no query string at all (1).

Thanks,

Tom


Feb 15 '06 #3
The c# version should be Request.QueryString["yourQueryString"].

if (Request.QueryString["yourValue"] == null) means that a parameter by
the name r does not exist, so there is not a parameter.

Check out this webpage. They take the items into a
NameValueCollection. Then if the collections count = 0, there are no
params.

HTH,
Darren Kopp
http://blog.secudocs.com/

Feb 15 '06 #4
I should have read the question..

Try:
If(Request.QueryString.Count = 0) Then

End If
"tshad" <ts**********@ftsolutions.com> wrote in message
news:Oy**************@TK2MSFTNGP14.phx.gbl...
I don't understand.

I am not checking if there is a particular parameter there. I want to
know if the URL has 0 parameters (file.aspx). file.aspx?r=1 has 1
parameter and file.aspx?r=1&st=joe has 2 parameters.

I want to be able to special processing if there is no parameters passed
at all. I don't want to check if r is nothing and st is nothing.

Thanks,

Tom
"Mr Ideas Man" <ad**@pertrain.com.au> wrote in message
news:Ob**************@TK2MSFTNGP11.phx.gbl...
IF (Request.QueryString("yourQueryString") Is Nothing) Then

END IF

Or

if(Request.QueryString("yourQueryString") == null)
{

}

Cheers,
Adam

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...
How do you check to see if there is no query string?

I could have:
1) file.aspx
2) file.aspx?r=5&st=joe

I need to know when there is no query string at all (1).

Thanks,

Tom



Feb 15 '06 #5
I couldn't remember if QueryString had a count property or not.
Request.QueryString.Count is definately the road I would use too.

:D

Darren Kopp

Feb 15 '06 #6
"Darren Kopp" <da********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
The c# version should be Request.QueryString["yourQueryString"].

if (Request.QueryString["yourValue"] == null) means that a parameter by
the name r does not exist, so there is not a parameter.
No - that means there is no 'r' parameter. I have a page that could have
10-15 parameters and I don't want to check if each is null.

I want to check to see if there was no parameters at all passed (no "?").

Thanks,

Tom
Check out this webpage. They take the items into a
NameValueCollection. Then if the collections count = 0, there are no
params.

HTH,
Darren Kopp
http://blog.secudocs.com/

Feb 15 '06 #7
"Darren Kopp" <da********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I couldn't remember if QueryString had a count property or not.
Request.QueryString.Count is definately the road I would use too.
I had thought about that but wasn't sure if it had a count property. I was
thinking there might be something like Request.QueryString.Items.count or
something like that. But I think is what I am looking for.

Thanks,

Tom
:D

Darren Kopp

Feb 15 '06 #8
Yea, I was the same, but i was without intellisense so I could only
give my first answer :s. Glad to hear you have found your solution
though.

Happy .NETing,
Darren Kopp

Feb 15 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Max | last post by:
Hello. This is the first time I've posted to a newsgroup, and I do this because I'm in desperate need of help. I'm working a user management system, and when I activate a user that has registered...
5
by: Arpan | last post by:
An ASP application retrieves records from a SQL Server database. In the first page of the application, the user has to enter a password & the columns retrieved from the DB table depends upon the...
4
by: Raterus | last post by:
Howdy, Simple question, but I can't figure out how to do it. I have a a page which is called initially with a querystring. After I get the querystring values, I don't need the querystring to...
4
by: Guoqi Zheng | last post by:
On my application, I need to have different action based on the pass in query string. When the query string is not presented, I try to use If request.querystring("id") ="" THEN ...... This is...
5
by: VB Programmer | last post by:
I have an ASPX page that is used for content. I have a master page which sticks the page in an IFrame. Question: From the content/ASPX page, I can't seem to reference request.querystring. Any...
1
by: C | last post by:
Hi, I have been using VB.Net for the past 2 years and have moved to C# I send a value in the URL to a page. In my called page I do below. int intTest = int.Parse(Request.QueryString);
6
by: Helter Skelter | last post by:
hi, i want to have a querystring in a webpage. i dont mind what it does (i just want to experiment with it). how do i get the asp.net page to do something when i type in a querystring? if you...
9
by: VancouverMike | last post by:
Hi there, I run into a very strange problem. I got the following url and am passing information via query string. The problem when the "sin" key in query string is blank, shown as in the...
2
by: Kim | last post by:
How do I get all walues if my querystring is empty? If I have a table with let's say 10 rows/records, (ID 1-10). I then have a recordset with request.querystring("id") and get the record having the...
2
by: Doogie | last post by:
Hi, I'm writing Javascript code to parse out a query string. I want to handle the case where a parameter value may not be sent. So consider a parameter called "State". If the user doesn't pass...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.