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. Identifying dynamic controls

Identifying dynamic controls

Scheduled Pinned Locked Moved ASP.NET
help
6 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.
  • V Offline
    V Offline
    vijayaBTS
    wrote on last edited by
    #1

    Hi All, I create 2 controls dynamically - one textbox and one "Add" button.These controls are present in 2 different groups.If I click the button it should add a textbox to the textbox group. I need to create the textboxes based on the button click. Any help would be appreciated.

    vijaya

    M 1 Reply Last reply
    0
    • V vijayaBTS

      Hi All, I create 2 controls dynamically - one textbox and one "Add" button.These controls are present in 2 different groups.If I click the button it should add a textbox to the textbox group. I need to create the textboxes based on the button click. Any help would be appreciated.

      vijaya

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      When you dynamically add the "Add" button, you can also add the event handler for the Click event to add the textbox at runtime. And you need to be careful when working with the dynamic controls as there two common mistakes that you may see: the dynamic controls get lost and the postback events do not execute. How to: Add Controls to an ASP.NET Web Page Programmatically [^]

      V 1 Reply Last reply
      0
      • M minhpc_bk

        When you dynamically add the "Add" button, you can also add the event handler for the Click event to add the textbox at runtime. And you need to be careful when working with the dynamic controls as there two common mistakes that you may see: the dynamic controls get lost and the postback events do not execute. How to: Add Controls to an ASP.NET Web Page Programmatically [^]

        V Offline
        V Offline
        vijayaBTS
        wrote on last edited by
        #3

        Hi Thanks for Reply. Actually my problem is Iam building two groups A and B.Each group contains one textbox and add button(all are builded dynamically).If i click on add button it should add textboxes to respective group.For add button click iam adding attributes and incrementing value from javascript using a hidden variable. btnAddRange.Attributes.Add("onclick","javascript:submitVIN('"+GroupId+"')") this is code for click on a button.How can we identify click is performed on respective group. Regards, Vijaya

        vijaya

        M 1 Reply Last reply
        0
        • V vijayaBTS

          Hi Thanks for Reply. Actually my problem is Iam building two groups A and B.Each group contains one textbox and add button(all are builded dynamically).If i click on add button it should add textboxes to respective group.For add button click iam adding attributes and incrementing value from javascript using a hidden variable. btnAddRange.Attributes.Add("onclick","javascript:submitVIN('"+GroupId+"')") this is code for click on a button.How can we identify click is performed on respective group. Regards, Vijaya

          vijaya

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

          Do you mean you want to determine which button is firing the event? and you might want to do that at the client side or the server side?

          V 1 Reply Last reply
          0
          • M minhpc_bk

            Do you mean you want to determine which button is firing the event? and you might want to do that at the client side or the server side?

            V Offline
            V Offline
            vijayaBTS
            wrote on last edited by
            #5

            Hi, Thanks for your reply. Sorry for delay in reply. My Problem was solved. I have one more Problem regarding this dynamic creation of controls. Delete option is there to delete respective row which is added by click on the add button.Iam using Request.form to read the values and save in to database.After clicking delete button ,Iam deleting that row value from database but page was loading values using request.form(control) but i need controls should load values from database. Pls Help me,My project was in delivery stage pls reply me as soon as possible.And Thanks for help. Thanks & Regards, Vijaya.K

            vijaya

            M 1 Reply Last reply
            0
            • V vijayaBTS

              Hi, Thanks for your reply. Sorry for delay in reply. My Problem was solved. I have one more Problem regarding this dynamic creation of controls. Delete option is there to delete respective row which is added by click on the add button.Iam using Request.form to read the values and save in to database.After clicking delete button ,Iam deleting that row value from database but page was loading values using request.form(control) but i need controls should load values from database. Pls Help me,My project was in delivery stage pls reply me as soon as possible.And Thanks for help. Thanks & Regards, Vijaya.K

              vijaya

              M Offline
              M Offline
              minhpc_bk
              wrote on last edited by
              #6

              Not sure about what your code is doing, but IMO you can simply refresh the control with the data in DB after you delete the row. In other words, you can have put your code somewhere else to set the control value, and this basically happens after the row is deleted.

              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