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. Dynamic Controls Problem

Dynamic Controls Problem

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdesignsysadminhelp
2 Posts 2 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.
  • M Offline
    M Offline
    mtone
    wrote on last edited by
    #1

    I am working with ASP.NET 2.0 and am haveing a hard time trying to add controls with a button click. Here is my scenerio. I have a panel runat= server on a form page. I have a Web user control that consists of about 8 text boxes and drop downs. At design time I add 4 controls to the page. Each control represents a row. Now If I need more rows I click the button and do this in my code. this.divServiceDetails.Controls.Add(Page.LoadControl("UserControls/ServiceDetails.ascx")); A new control gets added to my form no problem. When I try to add another it does not add another once I have already done it once. Can some tell me how to correct this problem or offer alternative method. Thanks -- modified at 21:41 Wednesday 30th November, 2005

    H 1 Reply Last reply
    0
    • M mtone

      I am working with ASP.NET 2.0 and am haveing a hard time trying to add controls with a button click. Here is my scenerio. I have a panel runat= server on a form page. I have a Web user control that consists of about 8 text boxes and drop downs. At design time I add 4 controls to the page. Each control represents a row. Now If I need more rows I click the button and do this in my code. this.divServiceDetails.Controls.Add(Page.LoadControl("UserControls/ServiceDetails.ascx")); A new control gets added to my form no problem. When I try to add another it does not add another once I have already done it once. Can some tell me how to correct this problem or offer alternative method. Thanks -- modified at 21:41 Wednesday 30th November, 2005

      H Offline
      H Offline
      hemant kaushal
      wrote on last edited by
      #2

      When we add controls at runtime they got added but after postback they lost i.e in panel each time new control is added and earlier one get lost well u can try to use a variable which increment each time u click to add and in loop base on variable add no of rows each time. It is just an hit and trial.

      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