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 all the Dynamically created controls ?

How to Get all the Dynamically created controls ?

Scheduled Pinned Locked Moved ASP.NET
questionhelptutorial
5 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.
  • S Offline
    S Offline
    SekharOne
    wrote on last edited by
    #1

    I have developed a web app where i am creating dynamic Input Type File controls for selecting multiple files at a time. All the dynamically created Input controls are placed under one div 'myDiv'. Now while postback, how can i iterate through all the controls inside myDiv so that I can get hold of all the files selected during that time. Please help. Thanks in advance.

    Sekhar :)

    C N 2 Replies Last reply
    0
    • S SekharOne

      I have developed a web app where i am creating dynamic Input Type File controls for selecting multiple files at a time. All the dynamically created Input controls are placed under one div 'myDiv'. Now while postback, how can i iterate through all the controls inside myDiv so that I can get hold of all the files selected during that time. Please help. Thanks in advance.

      Sekhar :)

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Well, if you didn't create them prior to Page_Load, the fact is, they are not going to have any viewstate, even if you recreate them. But, if they are input controls, then they will exist in the form that was posted, so that's not a problem. The div is irrelevant, the file data will exist in the data posted with the form.

      Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

      S 1 Reply Last reply
      0
      • C Christian Graus

        Well, if you didn't create them prior to Page_Load, the fact is, they are not going to have any viewstate, even if you recreate them. But, if they are input controls, then they will exist in the form that was posted, so that's not a problem. The div is irrelevant, the file data will exist in the data posted with the form.

        Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

        S Offline
        S Offline
        SekharOne
        wrote on last edited by
        #3

        Thanks for your reply. Can you please say me how can I reference to the form that has been posted back. I am an new to ASP.Net. Please help. Thanks.

        Sekhar :)

        C 1 Reply Last reply
        0
        • S SekharOne

          Thanks for your reply. Can you please say me how can I reference to the form that has been posted back. I am an new to ASP.Net. Please help. Thanks.

          Sekhar :)

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Page.Request.Form.AllKeys gives you a collection of strings, each of which is a key into the collection as in Page.Request.Form["key"], you can use this to iterate through the form objects.

          Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

          1 Reply Last reply
          0
          • S SekharOne

            I have developed a web app where i am creating dynamic Input Type File controls for selecting multiple files at a time. All the dynamically created Input controls are placed under one div 'myDiv'. Now while postback, how can i iterate through all the controls inside myDiv so that I can get hold of all the files selected during that time. Please help. Thanks in advance.

            Sekhar :)

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

            SekharOne wrote:

            are placed under one div 'myDiv'

            ASP.NET won't maintain viewstate for Dynamic controls created in page_load. You can add these controls to a DataGrid/GridView than to a DIV. So viewstate will be maintained along with the parent control and you can take the control by iterating through gridview's rows.

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

            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