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. How to get text from dyanmically created texboxes

How to get text from dyanmically created texboxes

Scheduled Pinned Locked Moved ASP.NET
databasehelptutorialquestion
4 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.
  • M Offline
    M Offline
    Muntyness
    wrote on last edited by
    #1

    HI, I have an ASP form, and I want to make it so that if you click on an "Add Follow-Up" button, a text box gets added to a table. I then want what ever the user puts in that text box to be saved when the submit button is pressed. My problem is that while I can create that text button the first time the Add Follow-up button is pressed, I can't save it to the database. When stepping through the code, it looks like there's nothing in the placeholder controls. (The followup textbox is added to a placeholder so I can get it to go where I want it to.) Is there any way to save this information to the database when pressing the Submit button? Thanks, Muntyness

    V N 2 Replies Last reply
    0
    • M Muntyness

      HI, I have an ASP form, and I want to make it so that if you click on an "Add Follow-Up" button, a text box gets added to a table. I then want what ever the user puts in that text box to be saved when the submit button is pressed. My problem is that while I can create that text button the first time the Add Follow-up button is pressed, I can't save it to the database. When stepping through the code, it looks like there's nothing in the placeholder controls. (The followup textbox is added to a placeholder so I can get it to go where I want it to.) Is there any way to save this information to the database when pressing the Submit button? Thanks, Muntyness

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      Did you check the contents of Request.Form[""] or Request.Params[""]

      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

      M 1 Reply Last reply
      0
      • M Muntyness

        HI, I have an ASP form, and I want to make it so that if you click on an "Add Follow-Up" button, a text box gets added to a table. I then want what ever the user puts in that text box to be saved when the submit button is pressed. My problem is that while I can create that text button the first time the Add Follow-up button is pressed, I can't save it to the database. When stepping through the code, it looks like there's nothing in the placeholder controls. (The followup textbox is added to a placeholder so I can get it to go where I want it to.) Is there any way to save this information to the database when pressing the Submit button? Thanks, Muntyness

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        To understand the problem clearly, you need to look through ASP.NET page life cycle. ViewState is stored and loaded in Init event. So all dynamic controls created after Init event won't maintain any viewstate. This is what you are not getting the control on postback. You need to find some other alternative like creating control on Init event.


        My Website | Ask smart questions

        1 Reply Last reply
        0
        • V Vasudevan Deepak Kumar

          Did you check the contents of Request.Form[""] or Request.Params[""]

          Vasudevan Deepak Kumar Personal Homepage Tech Gossips

          M Offline
          M Offline
          Muntyness
          wrote on last edited by
          #4

          Well I have now. *cough* Thanks. Can you think of any way of doing this for multiple new follow-ups? (I can think of a way of doing it with multiple old follow-ups, mainly by using whatever ID they have in the database as the ID for the textbox, and then when submitting the form, getting all of the IDs from an array, then looping through the array to get the information for the old followups from the text boxes and updating the database if needed. Of course if you know of a better way, I'd be happy to use it.) For new followups, I can only think of how to add 1 at a time, and I would prefer to be able to add multiple new ones if possible. (And I can't submit them to the database when adding new followups, as I need a ID which won't be generated until the entire form is submitted.) Thanks, Muntyness

          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