Solved

Session String[] Array?

Posted on 2012-03-22
5
207 Views
Last Modified: 2012-08-14
Q. How do I send & recieve a string[] in a Session?

string[] names = new string[3] {"Matt", "Joanne", "Robert"};

Session("nameArray") = names???
0
Comment
Question by:pointeman
  • 3
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
Umar Topia earned 500 total points
ID: 37751904
You can store anything in Session Varibale

However, while retrieving you will have to cast it in specific Type

string[] names = new string[3] {"Matt", "Joanne", "Robert"};

string[] strarrSessionNames = Session("nameArray") as string[];

or

string[] strarrSessionNames = (string[])(Session("nameArray"));
0
 
LVL 10

Expert Comment

by:Umar Topia
ID: 37751913
for storing it's a simply statement

string[] names = new string[3] {"Matt", "Joanne", "Robert"};

Session["nameArray"] = names;
0
 

Author Comment

by:pointeman
ID: 37755157
Okay, then access the info like:

string matt  = names[0].ToString();
string joanne  = names[1].ToString();
0
 
LVL 10

Expert Comment

by:Umar Topia
ID: 37755517
Yeah... once you get the array object
then you can play around with it in normal way
0
 

Author Closing Comment

by:pointeman
ID: 37759364
thx
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now