Checking for the existence of a variable in queryString

A

Andy B.

I want to provide 2 views for a page. The first view shows the
entire list of items on it. The other view shows only 1 item from the list
based on the ID in the query string that comes from an rss feed. How would I
check for the existence of ID in the query string?
 
G

Guest

        I want to provide 2 views for a page. The first view shows the
entire list of items on it. The other view shows only 1 item from the list
based on the ID in the query string that comes from an rss feed. How would I
check for the existence of ID in the query string?

Andy, you to get query string use QueryString Property
http://msdn.microsoft.com/en-us/library/system.web.httprequest.querystring.aspx

Example:

if (Request.QueryString["ID"] != null)
{
string id = Request.QueryString["ID"];
..... to get 1 item only
} else {
.... to get all items
}

Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top