Dynamically-generated form problem

Results 1 to 2 of 2

Thread: Dynamically-generated form problem

  1. #1
    Join Date
    Dec 1969

    Default Dynamically-generated form problem

    Here is what I am trying to do - I am creating a survey user control that will dynamically generate the form. I have a datalist bound to a collection of questions and in the ItemDataBound event handler, I am creating controls (i.e. textbox, radiobuttonlist, etc) depending on the question type. This works fine, but when it posts back, I see in the debugger that the controls are gone! The datalist is there but when I walk through its items, the Controls collection is empty. Please help!<BR><BR>Thanks,<BR><BR>Grant

  2. #2

    Default RE: Dynamically-generated form problem

    When you programticaly add controls instead of defining them in the html, you need to create them on each request.<BR><BR>To have them participate in "normal" viewstate, you need to create them early.<BR><BR>This message has an example:<BR>http://www.aspmessageboard.com/forum/CSharp.asp?M=582140&T=580461&F=39&P=1<BR><BR>Creat eChildControls<BR>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIControlClassCreateChildControlsTop ic.asp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts