Solved

ASP composite control with Datalist / Viewstate

Posted on 2004-04-20
5
425 Views
Last Modified: 2012-05-04

  I have a composite control that is dynamically loaded into a placeholder at runtime.

  All values on the control display properly including the datalist.  The datalist is not bound,  one list item is manually added.  

  On a postback that does nothing but refresh the page all controls display with the original values except the datalist.  I have a button to reload the datalist, when this is clicked, then all subsequent postbacks (refreshs of the page) retain the values in the datalist.

  The datalist does seem to retain viewstate on subsequent postbacks?   Instantiating the control from Init solves the problem..

  However, I am generating the controls off events,  I'm attempting not to use querystrings, but it may seem that is necessary.  

  I would except an example of how to use httpContext or other routes to capture postback information to generate the required control in the Init method.

  Thanks!!


0
Comment
Question by:dlarlick
  • 3
  • 2
5 Comments
 
LVL 2

Author Comment

by:dlarlick
ID: 10871671

Sorry it's a listbox not a datalist.  I see others have the same problem.

Need to persist listbox on initial load of control.
0
 
LVL 28

Expert Comment

by:mmarinov
ID: 10875625
do you say that when you do postback all of the controls ( dynamically added ) are showing correct except the listbox ?
if this is correct can you post the code that you recreate the controls ( or the code that you show the controls )

B..M
0
 
LVL 2

Author Comment

by:dlarlick
ID: 10877600

  The control is a composite control dynamically added to a placeholder based on a menu option.  All the controls within the composite control are added at design time.

  All the controls within the composite control show correct with values on the initial display.  A postback on the form will redisplay all controls correct with values EXCEPT the listbox.  The listbox control is there but all values are cleared.

  I took a look at the problem last night and loaded the project on my laptop.  For whatever reason the app on my laptop behaves correctly.

  I am looking into the possible differences...

  I will post a followup...  Thank you for your response.
0
 
LVL 2

Author Comment

by:dlarlick
ID: 10888153

  I believe the complication was due to attempting to initialize a value in the page_load of the control.

  Something with the viewstate seems to get confused when attempting to perform some simple processing in the page_load of the control.  I have removed all page_load processing from the control and no longer have the complication.  

  please close thread.
0
 
LVL 28

Accepted Solution

by:
mmarinov earned 500 total points
ID: 10888357
sorry, but i'm not a Page Editor in this TA and can not close the question
you have to post a question in Community Support to close this question

B..M
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

910 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

17 Experts available now in Live!

Get 1:1 Help Now