AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 How to store and retrieve Arrays in ViewState?
Posted by Moderator1 on  6/16/2010 9:20:11 AM 15165 Views
The tips below will help you to store and retrieve array objects in a ViewState variable.

//Array Declaration
string[] initArray = { "abc", "def", "ghi", "xyz" };

//Store Array in a ViewState
ViewState["ArrayData"] = initArray;

//Retrieve Array value in the ViewState back to the array variable
string[] finalArray = (string[])ViewState["ArrayData"];

Post New Tips/Tricks View all Tips/Tricks

Featured Resources:
Building a Web Application Security Program
Learn how to build a pragmatic web application security program that constrains costs while still providing effective security.
The ASP.NET 2.0 Anthology: 101 Essential Tips, Tricks & Hacks - Free 156 Page Preview
Learn the most practical features and best approaches for ASP.NET.
100% Free Subscription until Stock lost.View complete list.
Sponsored by