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. Programatically add controls

Programatically add controls

Scheduled Pinned Locked Moved ASP.NET
questionhelp
3 Posts 3 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.
  • I Offline
    I Offline
    Illegal Operation
    wrote on last edited by
    #1

    Hi! I need some help. I have a web control that has Labels with text set to Monday Tuesday etc. Beneath these labels are textboxes. I also have a button with the text "Add". When I click the add button a new row of textboxes should be places beneath the already existing ones. How can I go about reaching this? thank you!!

    Illegal Operation

    D D 2 Replies Last reply
    0
    • I Illegal Operation

      Hi! I need some help. I have a web control that has Labels with text set to Monday Tuesday etc. Beneath these labels are textboxes. I also have a button with the text "Add". When I click the add button a new row of textboxes should be places beneath the already existing ones. How can I go about reaching this? thank you!!

      Illegal Operation

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      If the maximum number of rows possible is quite less, then place all the textboxes in the rows at design time (with display set to none). Then, on click of the add button, just change the display through javascript. If there is no limit or a high limit for the maximum number of textboxes possible, add them dynamically using TextBox class through code behind.

      50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

      1 Reply Last reply
      0
      • I Illegal Operation

        Hi! I need some help. I have a web control that has Labels with text set to Monday Tuesday etc. Beneath these labels are textboxes. I also have a button with the text "Add". When I click the add button a new row of textboxes should be places beneath the already existing ones. How can I go about reaching this? thank you!!

        Illegal Operation

        D Offline
        D Offline
        Dinesh Mani
        wrote on last edited by
        #3

        What is the container control that you have? If you are using a gridview then add a footer row and show it when you click the Add row button. This off-course is the simplest way to do it but would work for only one row at a time, i.e. you can have only one footer row per gridview. Continuing with gridview, if you need more rows and assuming you are using bound columns, just add an empty row to your data source and refresh the binding. Again very simple to do. If you are not using a gridview and assuming you use HTML tables, then your table should be visible on the server and you need to generate and insert HTML script, which can get a bit clumsy at times.

        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