Dynamic Controls

Results 1 to 2 of 2

Thread: Dynamic Controls

  1. #1
    Join Date
    Dec 1969

    Default Dynamic Controls

    I am trying to create Dynamic Control based on the radiobutton&#039;s selection. I am having problem with one of the dynamic dropdownlist.<BR><BR>The Code of the Dropdownlist creation:<BR>Dim ReportType As New DropDownList<BR>ReportType.id = "ddlReportType"<BR>ReportType.Attributes("RunA t") = "server"<BR>ReportType.AutoPostBack = True<BR>ReportType.Attributes("OnSelectedIndexChan ged") = "Changed"<BR>ReportType.EnableViewState = True<BR>ReportType.CssClass = "formstyle"<BR>ReportType.Items.Add("Please Select")<BR>ReportType.Items.Add("--------------")<BR>ReportType.Items.Add("Daily")<BR>ReportType. Items.Add("Weekly")<BR>ReportType.Items.Add("Month ly Sales Report")<BR>ReportType.Databind()<BR><BR>Now, I were to change the selection from the dropdownlist, the whole panel&#039;s dynamic web controls will disappear due to the postback. Plus it did not run the OnSelectedIndexChanged&#039;s event. Is there any way to solve the problems?

  2. #2
    Join Date
    Dec 1969

    Default RE: Dynamic Controls

    Dynamic controls need to be recreated on every subsequent postback. Dynamically assigned event handlers need to be reassigned on every subsequent postback. There is a tutorial available on http://aspnet.4guysfromrolla.com/. Please read it.

Posting Permissions

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