Solved

ASP composite control with Datalist / Viewstate

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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