Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. CompositeControl with dynamic controls

CompositeControl with dynamic controls

Scheduled Pinned Locked Moved ASP.NET
questiondatabasehelptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cgreathouse
    wrote on last edited by
    #1

    I have a class that inherits from CompositeControl that dynamically creates controls at runtime (typically 2-5 DropDownList controls). All of the control creation is happening in CreateChildControls(). When a page using that control first loads everything is correct. However, after the selected index is not being remembered. It doesn't matter what is selected in the DropDownList controls, SeletedItem or SelectedValue is always the first item in the control. I then found some posting that said AutoPostBack needs to be set on the DropDownList Controls and that a check for IsPostBack needed to be put in CreateChildControls(). I did that but when a new item in any of the DropDownList controls was selected, all of the DropDownList controls were empty. I then saw something that said for the ViewState to be preserved, the DropDownList control must first be added (i.e. Controls.Add()) and then load the control. That didn't help either. Has anyone done anything like this before? Any guidance and how to get this thing to work? Thanks!

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups