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. I need knowhow/article about adding input controls dynamically in asp.net

I need knowhow/article about adding input controls dynamically in asp.net

Scheduled Pinned Locked Moved ASP.NET
csharphtmlcssasp-netdatabase
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
    mulgurul
    wrote on last edited by
    #1

    Well nearly getting familiar with asp.net, theres one thing I still havent figured out! I dont have the time to do this myself, so I hope someone did me (and others) the favorit, to check it out and write about it. Pseudo code: while not rs.EOF Response.write("" & rs("jobtypename") rs.next loop In old school ASP I did this day in day out, but in ASP.NET !!!!! Well I know things have changed, and i read about page life cycle, I tried datagrids and views and many things. But I still havent found a good way to add many similar controls dynamically to a webpage under asp.net. And I dont want grids or radiobutton lists. I often make a dynamically html table, where there's different controls in some of the columns, and they wil refeer to the row id from the DB (yes I now its grid like) but I want to built it myself in the code behind iterating the record set. The problem is that I can add the controls and other stuff during first "!IsPostback" but then they will be gone after another "runat=server" control does a postback. And they dont keep their values in between postback, because they cannot be "runat=server and dont get part of the viewstate data. So if you now a way of dealing with this problem, or an article describing it, I would be terrible glad to hear about it. Regards from Mulgurul, The last wave is yet to come!

    J K 3 Replies Last reply
    0
    • M mulgurul

      Well nearly getting familiar with asp.net, theres one thing I still havent figured out! I dont have the time to do this myself, so I hope someone did me (and others) the favorit, to check it out and write about it. Pseudo code: while not rs.EOF Response.write("" & rs("jobtypename") rs.next loop In old school ASP I did this day in day out, but in ASP.NET !!!!! Well I know things have changed, and i read about page life cycle, I tried datagrids and views and many things. But I still havent found a good way to add many similar controls dynamically to a webpage under asp.net. And I dont want grids or radiobutton lists. I often make a dynamically html table, where there's different controls in some of the columns, and they wil refeer to the row id from the DB (yes I now its grid like) but I want to built it myself in the code behind iterating the record set. The problem is that I can add the controls and other stuff during first "!IsPostback" but then they will be gone after another "runat=server" control does a postback. And they dont keep their values in between postback, because they cannot be "runat=server and dont get part of the viewstate data. So if you now a way of dealing with this problem, or an article describing it, I would be terrible glad to hear about it. Regards from Mulgurul, The last wave is yet to come!

      J Offline
      J Offline
      Jon Sagara
      wrote on last edited by
      #2

      http://support.microsoft.com/kb/317515[^] The most important point: "The controls are created every time that the page is run. The best place to do this is in the Page_Init function that the [YourPage] class provides."

      Jon Sagara I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So i had to leave the place as soon as possible. --Mr.Prakash Blog | Site | Articles

      1 Reply Last reply
      0
      • M mulgurul

        Well nearly getting familiar with asp.net, theres one thing I still havent figured out! I dont have the time to do this myself, so I hope someone did me (and others) the favorit, to check it out and write about it. Pseudo code: while not rs.EOF Response.write("" & rs("jobtypename") rs.next loop In old school ASP I did this day in day out, but in ASP.NET !!!!! Well I know things have changed, and i read about page life cycle, I tried datagrids and views and many things. But I still havent found a good way to add many similar controls dynamically to a webpage under asp.net. And I dont want grids or radiobutton lists. I often make a dynamically html table, where there's different controls in some of the columns, and they wil refeer to the row id from the DB (yes I now its grid like) but I want to built it myself in the code behind iterating the record set. The problem is that I can add the controls and other stuff during first "!IsPostback" but then they will be gone after another "runat=server" control does a postback. And they dont keep their values in between postback, because they cannot be "runat=server and dont get part of the viewstate data. So if you now a way of dealing with this problem, or an article describing it, I would be terrible glad to hear about it. Regards from Mulgurul, The last wave is yet to come!

        K Offline
        K Offline
        krishna19
        wrote on last edited by
        #3

        http://www.dotnetjohn.com/articles.aspx?articleid=44[^] Also add the call to the function that adds your controls in Page_OnInit function in web form generated code.

        If you fail for the first time , call it version 1.0.

        1 Reply Last reply
        0
        • M mulgurul

          Well nearly getting familiar with asp.net, theres one thing I still havent figured out! I dont have the time to do this myself, so I hope someone did me (and others) the favorit, to check it out and write about it. Pseudo code: while not rs.EOF Response.write("" & rs("jobtypename") rs.next loop In old school ASP I did this day in day out, but in ASP.NET !!!!! Well I know things have changed, and i read about page life cycle, I tried datagrids and views and many things. But I still havent found a good way to add many similar controls dynamically to a webpage under asp.net. And I dont want grids or radiobutton lists. I often make a dynamically html table, where there's different controls in some of the columns, and they wil refeer to the row id from the DB (yes I now its grid like) but I want to built it myself in the code behind iterating the record set. The problem is that I can add the controls and other stuff during first "!IsPostback" but then they will be gone after another "runat=server" control does a postback. And they dont keep their values in between postback, because they cannot be "runat=server and dont get part of the viewstate data. So if you now a way of dealing with this problem, or an article describing it, I would be terrible glad to hear about it. Regards from Mulgurul, The last wave is yet to come!

          K Offline
          K Offline
          krishna19
          wrote on last edited by
          #4

          http://aspnet.4guysfromrolla.com/articles/092904-1.aspx[^]

          If you fail for the first time , call it version 1.0.

          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