Solved

View State Causing DataList to disappear

Posted on 2009-04-10
3
474 Views
Last Modified: 2012-05-06
We have a ArrayList that we bind to a DataList, then we create a viewstate that contains the ArrayList.  The final line in the code,

ViewState["ParamArray"] = alParams;

is causing the DataList to disappear when we debug. If I comment out the above line, the DataList appears. Any help is appreciated.

PS - I am kind of new to ASP.NET, so let me apologize if my phrasing or anything is incorrect.
//dlParams is a DataList
 
               ArrayList alParams= new ArrayList();
                
                foreach (string s in _xmlParams)
                {
                    ReportParameters reportParameters = new ReportParameters();
                    
                    etc, etc, etc, etc
 
                    reportParameters.ID = newID;
                    reportParameters.Caption = newTitle;
                    reportParameters.DefaultValue = defval;
 
                    alParams.Add(reportParameters);
                    dlParams.DataSource = alParams;
                    dlParams.DataBind();
 
                    ViewState["ParamArray"] = alParams;
 
                }

Open in new window

0
Comment
Question by:gregalhaig1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Assisted Solution

by:spprivate
spprivate earned 100 total points
ID: 24117904
Move the view state commad out of the loop.
Also are you loading this Datalist in the pageload.If so make sure you put a  Postback check in the code
0
 

Author Comment

by:gregalhaig1
ID: 24118248
I am loading the DataList on a button_Click event. I did move it outside the loop, but so far same result as before.
0
 

Accepted Solution

by:
gregalhaig1 earned 0 total points
ID: 24119028
I used a session instead and that worked...not the exact way I wanted to do this, but it will work for now. Thanks for help!
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

628 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