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 the value of dynamic web user control

how to get the value of dynamic web user control

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestionannouncement
3 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.
  • E Offline
    E Offline
    enjoycrack
    wrote on last edited by
    #1

    Hi, I have a page that uses dynamic generated web user control(textbox control). on the dynamic.aspx that contains a two-column table. The first column has a bunch of labels, and the second a bunch of textboxes. It'll be generated whenn user clicks on button Dynamic_Click after generating, user enters some info into textboxes and click Update button The problem when I access the content of the textboxes after postback: the property of table.Rows is always is 0 Any ideas?Any suggestions would be greatly appreciated thanks in advance:zzz:

    J 1 Reply Last reply
    0
    • E enjoycrack

      Hi, I have a page that uses dynamic generated web user control(textbox control). on the dynamic.aspx that contains a two-column table. The first column has a bunch of labels, and the second a bunch of textboxes. It'll be generated whenn user clicks on button Dynamic_Click after generating, user enters some info into textboxes and click Update button The problem when I access the content of the textboxes after postback: the property of table.Rows is always is 0 Any ideas?Any suggestions would be greatly appreciated thanks in advance:zzz:

      J Offline
      J Offline
      Jesse Squire
      wrote on last edited by
      #2

      I'm assuming that your table is being generated server-side on a postback. If that isn't the case, the same concept will still apply, you'll be limited to my second suggestion and the implementation details will differ. Any controls that you generate programatically are not automatically recreated for you at postback. In order to recieve the post data, you'll have to recreate your dynamic controls, with the same Id, and site them (and all parents) into the same container on the page before the end of the Load event. The idea is to assure that the same UniqueID is assigned to the control. Doing so should allow your textboxes to recieve thier post data. As an alternative, you can simply track the UniqueID of each textbox and scrape the request parameters. The scrape syntax would look something like string myValue = Request.Params["MyTable_TextBox1"];. When tracking the ids, be sure not to store the UniqueID property until you've sited the textbox and all parents onto the page. Hope that helps. :) --Jesse

      E 1 Reply Last reply
      0
      • J Jesse Squire

        I'm assuming that your table is being generated server-side on a postback. If that isn't the case, the same concept will still apply, you'll be limited to my second suggestion and the implementation details will differ. Any controls that you generate programatically are not automatically recreated for you at postback. In order to recieve the post data, you'll have to recreate your dynamic controls, with the same Id, and site them (and all parents) into the same container on the page before the end of the Load event. The idea is to assure that the same UniqueID is assigned to the control. Doing so should allow your textboxes to recieve thier post data. As an alternative, you can simply track the UniqueID of each textbox and scrape the request parameters. The scrape syntax would look something like string myValue = Request.Params["MyTable_TextBox1"];. When tracking the ids, be sure not to store the UniqueID property until you've sited the textbox and all parents onto the page. Hope that helps. :) --Jesse

        E Offline
        E Offline
        enjoycrack
        wrote on last edited by
        #3

        Hi Jesse, Could you please send me an example? 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