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. dynamic controls disappear after clicking a button

dynamic controls disappear after clicking a button

Scheduled Pinned Locked Moved ASP.NET
csharphelp
8 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.
  • W Offline
    W Offline
    walalawll
    wrote on last edited by
    #1

    I get a problem on writing a web page using C#.net 2.0. I have added some check boxes to a table cell and a button. When I check on some of the check boxes and the click the button, the table cell's find controls cannot find out the control.... And the web page doesn't know which check boxes have been checked Many Many Thanks for helping~~

    E Q 2 Replies Last reply
    0
    • W walalawll

      I get a problem on writing a web page using C#.net 2.0. I have added some check boxes to a table cell and a button. When I check on some of the check boxes and the click the button, the table cell's find controls cannot find out the control.... And the web page doesn't know which check boxes have been checked Many Many Thanks for helping~~

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

      you have to add controls after each post back...try this... << >>

      8x Solutions Ltd

      W 1 Reply Last reply
      0
      • W walalawll

        I get a problem on writing a web page using C#.net 2.0. I have added some check boxes to a table cell and a button. When I check on some of the check boxes and the click the button, the table cell's find controls cannot find out the control.... And the web page doesn't know which check boxes have been checked Many Many Thanks for helping~~

        Q Offline
        Q Offline
        qtuan
        wrote on last edited by
        #3

        Hi, I think you don't determine cell's ID that you find control.

        W 1 Reply Last reply
        0
        • E enjoycrack

          you have to add controls after each post back...try this... << >>

          8x Solutions Ltd

          W Offline
          W Offline
          walalawll
          wrote on last edited by
          #4

          Thanks for your reply. But if I need to add controls after each post back, then I don't know which check boxes have been clicked by the user.

          E 1 Reply Last reply
          0
          • Q qtuan

            Hi, I think you don't determine cell's ID that you find control.

            W Offline
            W Offline
            walalawll
            wrote on last edited by
            #5

            Hi, Thanks for your reply. I have used the debug mode to check the controls in table cell and using the while loop to get the controls one by one. But I still cannot find the check box in the table cell. Please kindly help. Thanks again

            E Q 2 Replies Last reply
            0
            • W walalawll

              Thanks for your reply. But if I need to add controls after each post back, then I don't know which check boxes have been clicked by the user.

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

              so for this issue...you might store checjbox's states in a hidden field, or session, or somewhere else,.. so that you can read and bind these when creating checkboxes dynamically... Hope you get the idea << >>

              8x Solutions Ltd

              1 Reply Last reply
              0
              • W walalawll

                Hi, Thanks for your reply. I have used the debug mode to check the controls in table cell and using the while loop to get the controls one by one. But I still cannot find the check box in the table cell. Please kindly help. Thanks again

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

                Yes you cannot find the controls which added dynamically as web is stateless env...that's why you have to re-create after each postback... << >>

                8x Solutions Ltd

                1 Reply Last reply
                0
                • W walalawll

                  Hi, Thanks for your reply. I have used the debug mode to check the controls in table cell and using the while loop to get the controls one by one. But I still cannot find the check box in the table cell. Please kindly help. Thanks again

                  Q Offline
                  Q Offline
                  qtuan
                  wrote on last edited by
                  #8

                  Hi, You can use the code in the code behind: for (int i = 0; i < TableID.Rows.Count; i++) { CheckBox chk = (CheckBox)TableID.Rows[i].FindControl("CheckBoxId"); if(chk.Checked) // checkbox checked else // not check } I hope it help for you

                  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