Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have session array which is added in Session

and want to get value of that session in next page.

how to get array value in next page from session into string array
Posted
Updated 26-Dec-13 18:34pm
v2
Comments
TrushnaK 27-Dec-13 0:01am    
improve your question and provide more information...
maulikshah1990 27-Dec-13 0:05am    
The following is procedure what is do

In test1.aspx page_load ,
string[] a = new string[]{"a","b","c"};

Session["GetHere[]"]= a;

Response.Redirect("test2.aspx");

----------------

In test2.aspx

I want Session["GetHere[]"] value in string array and continue
TrushnaK 27-Dec-13 0:36am    
are you want to assign session value to any controls in test2.aspx page ?

In page 1 do this instead:

C#
string[] a = new string[]{"a","b","c"};

Session["GetHere"]= a;
Response.Redirect("test2.aspx");


In page 2 use it like:

C#
string[] data = Session["GetHere"] as string;

if (data != null)
{
  // use data variable it contains the array data
}
 
Share this answer
 
string[] myarray={"value1","value2"};

session["mysession"]=myarray;

on next page

if(session["mysession"]!=null)
string[] getmyarray=(srting[])session["mysession"];

hope this helps!!!
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900