Solved

ASP composite control with Datalist / Viewstate

Posted on 2004-04-20
5
431 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

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…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

810 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