Solved

ASP composite control with Datalist / Viewstate

Posted on 2004-04-20
5
447 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
[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
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

724 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