I am working in asp.net and i want to know about how can we send value from one page to another page using query string?
query string
Hello sir ...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Dec 19, 2013, 7:46 AM
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.
For example:-
In page 1:
Drag and drop the one textbox and button control
In page 2:
Drag and drop the one textbox control from tool box and place it on form.
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
Jignesh TrivediPosted Dec 19, 2013, 7:41 AM
Query string is pass data in url..
example
http://localhost/home.aspx?id=1000
if you want to pass the data from one page to other page...
in first page...
Response.Redirect("mydatapage.aspx?Id=1000");
in mydatapage.aspx.cs page load event
private void Page_Load(object sender, System.EventArgs e)
{
var id = Request.QueryString["Id"];
}
please refer
http://www.codeproject.com/Articles/5876/Passing-variables-between-pages-using-QueryString
http://www.dotnetperls.com/querystring
hope this will help you.