Query string
What is use of query string ? and how to use the query string? with Examples...
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Jignesh TrivediRank #16 · 50.3K reputationPosted Sep 4, 2012, 10:07 PM EDT
A query string is information that is appended to the end of a page URL.
Example:
http://localhost:300/default.aspx?id=1000
and you can retrieve it from serverside.
var id = Request.QueryString["id"];
Please refer
http://www.codeproject.com/Articles/5876/Passing-variables-between-pages-using-QueryString
hope this will help you.
Satyapriya NayakRank #47 · 31.5K reputationPosted Sep 4, 2012, 10:07 PM EDT
Query string is used to Pass the values or information form one page to another page.
Syntax
Request.QueryString(variable)[(index)|.Count]
Parameters
variable :-
Specifies the name of the variable in the http query string to retrieve.
index :-
An optional parameter that enables you to retrieve one of multiple values for variable. It can be any integer value in the range 1 to Request.QueryString(variable).Count.
Example
In page one:-
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'bind the textbox values to querystring
Response.Redirect("Default2.aspx?Textboxvalue=" & TextBox1.Text)
End Sub
End Class
In page two:-
Partial Class Default2
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Get the values from Query string
TextBox1.Text = Request.QueryString("Textboxvalue")
End Sub
End Class
Thanks
raghavendra p8 reputationPosted Sep 4, 2012, 10:45 PM EDT