.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> ASP.NET >> Post New Resource Bookmark and Share   

 Subscribe to Articles

What is the Querystrings?

Posted By:varun bansal       Posted Date: July 28, 2009    Points: 25    Category: ASP.NET    URL: http://www.dotnetspark.com  
 

By Query string variables, you can pass data between webforms in application.
Below is an example


      
Example:

Suppose you want to pass the value of TextBox1.Text variable from page default1 to default2 on button click event. then write below code.
                    
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("default2.aspx?id=" + TextBox1.Text);
}
               

Now, Read the value of  "id" (from query string) in default2.

use the below code

protected void Page_Load()
{
string queryStringID = Request.QueryString["id"];
            
//Now variable queryStringID will hold the data from the querystring.            

label1.text=queryStrignID;
}


Regards

varun bansal

www.varunbansal007.blogspot.com

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend