ASP.NET - Passing Multiple Values in Querystring

Using the Querystring is the another method to pass information between pages in your ASP.NET application. As we know that Querystring is the portion of the URL after a Question Mark(?). The information is always retrieved as a string that can be converted with any type.Here we get the code to pass multiple values at a single time in Querystring.




Passing multiple Values:

protected void btnSubmit_Click(object sender, EventArgs e)
{
string name = txtName.Text;
string Userid = txtUserid.Text;
Response.Redirect("UserProfile.aspx?username= "+name+"&userid="+Userid);
}

Retrieving Values:

string name = Request.QueryString["name"].ToString();
string userid = Request.QueryString["Userid"].ToString();

Author Bio : I am Arun Rana a 21 years old Part time blogger having a tech Blog Speak Journal ,loves to write about latest Gadgets , Smartphones and all stuff related to technology.

Suggested Entry:

Passing Variables between Pages using QueryString in .Net
ASP.NET SessionState- Handling State in ASP.NET, Set Timeout for Session
Cookies with Multiple Values in ASP.NET
ASP.NET Cookies – Creating, Retrieving and Deleting Cookies
Passing Data Between Window Forms in C#.NET

admin (157 Posts)


Leave a reply

Your email address will not be published.

Comment moderation is enabled. Your comment may take some time to appear.