dynamic controls

Results 1 to 3 of 3

Thread: dynamic controls

  1. #1
    Join Date
    Dec 1969

    Default dynamic controls

    Hi all, I posted this yesterday but no luck.<BR><BR>1. I have a dropdownlist which is hooked up to this event:<BR>e.g. it creates a number of texboxes based on a number selected in the dropdownlist.<BR>It also has a button that is created:<BR><BR>sub ddList_SelectedIndexChanged()<BR>...<BR>Dim btnSubmit As New Button<BR>btnSubmit.EnableViewState = True<BR> Page.Controls.Add(btnSubmit)<BR> Panel1.Controls.Add(btnSubmit)<BR> btnSubmit.Text = "Add User"<BR> AddHandler btnSubmit.Click, AddressOf Me.testing<BR>End Sub<BR><BR>Problem: on click the &#039;testing&#039; event isn&#039;t fired and the controls (button and text fields) all disappear as in the page first load.<BR><BR>any hints on how to do this?<BR>

  2. #2
    Join Date
    Dec 1969

    Default and as answered yesterday

    http://www.aspmessageboard.com/forum/aspplus.asp?M=715943&T=715942&F=36&P=1<BR><BR>you have to re-create the controls on every Page_Load

  3. #3
    Join Date
    Dec 1969

    Default RE: dynamic controls

    The button has to be created at every postback and the id of the button has to be kept same to retain viewstate.

Posting Permissions

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