Have you looked at the .NET documentation? It fully documents all of this -
it is a lot faster to spend 1 minute reading the documentation, then waiting
for hours for someone to respond to your post. You would also probably end
up learning a lot of other useful things.
To answer your question, no there is not a method that will tell if a key
exists. There is a Keys collection - but you would have to loop through it
and check to see if the current key is the same as the one you are looking
for.
This is a lot more work then just checking if the value is null - which by
the way, is just as good a way to test if a key was passed in as anything
else.
"A.M" <no*****@online .nospam> wrote in message
news:uw******** ******@TK2MSFTN GP10.phx.gbl...
Thanks for help
So QueryString doesn't have any method for checking the existance of a
key?
Alan
"Marina" <so*****@nospam .com> wrote in message
news:uN******** ******@tk2msftn gp13.phx.gbl... No, that's pretty much it. You can change it to be a shorter using
something like:
Label1.Text = Request.QuerySt ring["id"] == null ? "NoId" :
Requesty.QueryS tring["id"];
"A.M" <no*****@online .nospam> wrote in message
news:%2******** *******@TK2MSFT NGP09.phx.gbl.. . Hi,
To check if QueryString contains a key I compaire it with null like
this code:
if (Request.QueryS tring["id"]!=null)
{
Label1.Text= Request.QuerySt ring["id"];
}
else
{
Label1.Text= "NoId";
}
Is it the best way to do see if QueryString contains a key or I am missing some better method in QueryString?
Thanks,
Alan