What is query string and how to use it in ASP.Net?



In this article i will describe What is Query String and how to use it?

A query string is information that is appended to the end of a pafe URL. A typical query string might look like the following example :


In this URL path, the query string starts with the question mark (?) and includes two attribute-value pairs, oe called category and other called price.

Query String provide a simple but limited way of maintaing state information. For example, they are an easy way to pass information from one page to another, such as passing a product number from one page to another page where it will be processed. However, some browsers and client devices impose a 255-character limit on the length of the URL.


In the Previous articles i explained how to retrieve value from query string using C# and ASP.Netwhat is namespace for arraylistGet Selected RadioButton Value of RadioButtonList using C# and ASP.Nethow to create serial no. column in gridview using asp.net, Add check boxes column in DataGridView for deleting records from database and many more about ASP.Net.


Step 1. 

Send Value From One page to another using URL like Following :


Step 2.

Now the Next step is get the value from Query String.

Suppose you want to get value from query string "price".

You can use Below Code :


Above Code give you the result "500". Because Query String "Price" has value "500".

Give your Valuable Comments.
comments powered by Disqus
Follow me on twitter
About Me
Harpreet Singh
I began programming with C++ when i was 17. Then at the middle of my study .NET came. Then I began to read C# and VB.NET. By the time i learnt SQL and ASP.NET, and developed some websites such as news portals that are active now. Currently i am running my own Software company.
More Articles