.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 >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

how to pass Multiple querystrings in the page

Posted By:Syed Shakeer Hussain       Posted Date: March 09, 2009    Points: 10    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  
 

Here's an example on how to pass Multiple querystrings in the page..

Page1

protected void Button1_Click(object sender, EventArgs e)
{
        string empName = "NET";
        string empAddress = "HYD";
        string strDate = DateTime.Now.ToShortDateString();
        Response.Redirect(string.Format("Page2.aspx?param1={0}¶m2={1}¶m3={2}", empName , empAddress,strDate));

}

The on Page2 you can get each values this way below

protected void Page_Load(object sender, EventArgs e)
{
        if ((Request.QueryString["param1"] != null && Request.QueryString["param2"] != null) && Request.QueryString["param3"] != null)
        {
            string name = Request.QueryString["param1"];
            string address = Request.QueryString["param2"];
            string date = Request.QueryString["param3"];

        }
}


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

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