Click here to Skip to main content
12,064,822 members (44,906 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
Hi All,

I want to pass multiple string values from one aspx page to another aspx page.
I am able to send one value but how to pass multiple values at the time when the page is redirected from one page to another page.

For example : string s = "ABC";
string s1 = "PQR";
string s2 = "LMN";

I am able to pass one value like this : Response.Redirect("~/PrintBilledReport.aspx?sentence=" + s);

I want to send all s,s1 and s2 from one page to another page. Please tell me the proper format how to pass the multiple values from one page to another page.

Thanks in advance...
Posted 23-Dec-12 21:06pm
rp786415
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Comments
rp786 24-Dec-12 2:46am
   
Thanks it worked..
__TR__ 24-Dec-12 3:02am
   
You're welcome.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Instead of using session I would suggest you to use QueryString only. Just have a look below:
In Page 1:
Response.Redirect("~/PrintBilledReport.aspx?sentence="+s+"&word="+s1+"&letter"+s3);
In Page 2:
string s1 = Request.QueryString["sentence"];
string s2 = Request.QueryString["word"];
string s3 = Request.QueryString["letter"];
Now you can use the string variables in 2nd page.

--Amit
  Permalink  
Comments
rp786 24-Dec-12 2:46am
   
Thanks all of you. The solutions worked.
__TR__ 24-Dec-12 3:02am
   
My 5!
_Amy 24-Dec-12 3:09am
   
Thank you Tejas.. :)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

on First page :
string s = "ABC";
string s1 = "PQR";
string s2 = "LMN";
 
Session["s"] = s;
Session["s1"] = s1;
Session["s2"] = s2;

On Second page :
string str, str1, str2;
 
str = Session["s"].ToString(); 
str1 = Session["s1"].ToString(); 
str2 = Session["s2"].ToString(); 
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160204.4 | Last Updated 24 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100