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. Access Click Event in Dynamically Built DataGrid

Access Click Event in Dynamically Built DataGrid

Scheduled Pinned Locked Moved ASP.NET
javascriptcssdatabasecomsysadmin
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.
  • H Offline
    H Offline
    Harmonium
    wrote on last edited by
    #1

    I have developed a form with a datagrid based on the code provided by Mark Killmer found here at http://www.codeproject.com/asspnet/griddemo.asp and http://www.codeproject.com/asspnet/griddemo2.asp. My grid requires LinkButtons instead of Drop Downs, TextBoxes, or CheckBoxes. I have the grid populated and the LinkButtons do appear, however I am unable to trigger the click event so that I can move from this form to another form. I tried both methods from his follow-up article, but the server side code is not triggered and the JavaScript code location.href = "http://www.site.com/newpage.aspx" does not work either. Anyone have an idea of how I can acheive this functionality? Thank you, Anthony

    M 1 Reply Last reply
    0
    • H Harmonium

      I have developed a form with a datagrid based on the code provided by Mark Killmer found here at http://www.codeproject.com/asspnet/griddemo.asp and http://www.codeproject.com/asspnet/griddemo2.asp. My grid requires LinkButtons instead of Drop Downs, TextBoxes, or CheckBoxes. I have the grid populated and the LinkButtons do appear, however I am unable to trigger the click event so that I can move from this form to another form. I tried both methods from his follow-up article, but the server side code is not triggered and the JavaScript code location.href = "http://www.site.com/newpage.aspx" does not work either. Anyone have an idea of how I can acheive this functionality? Thank you, Anthony

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

      Hi there, You dynamically add controls at runtime, you also need to reinsert them during postback to the server in order for the postback events to run properly. For more information, you can also look at the following documents: Adding Controls to a Web Forms Page Programmatically[^] Control Execution Lifecycle[^]

      H 1 Reply Last reply
      0
      • M minhpc_bk

        Hi there, You dynamically add controls at runtime, you also need to reinsert them during postback to the server in order for the postback events to run properly. For more information, you can also look at the following documents: Adding Controls to a Web Forms Page Programmatically[^] Control Execution Lifecycle[^]

        H Offline
        H Offline
        Harmonium
        wrote on last edited by
        #3

        I read the two articles that you suggested and did not see how to solve my problem. I may have also missed it since my due date for this assignment is this Wednesday. If you have any other information or sites to check out please help. Thank you.

        H M 2 Replies Last reply
        0
        • H Harmonium

          I read the two articles that you suggested and did not see how to solve my problem. I may have also missed it since my due date for this assignment is this Wednesday. If you have any other information or sites to check out please help. Thank you.

          H Offline
          H Offline
          Harmonium
          wrote on last edited by
          #4

          I got it!!! Once I set page directives EnableViewState to true my post back worked properly. Thank you...:)

          1 Reply Last reply
          0
          • H Harmonium

            I read the two articles that you suggested and did not see how to solve my problem. I may have also missed it since my due date for this assignment is this Wednesday. If you have any other information or sites to check out please help. Thank you.

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

            Well-done, In fact, these two links don't give you a straight answer, but they do give you some ideas on how the controls work especially when they are dynamically added. Once you understand the life cycle of the control, things become much easier for you.

            H 1 Reply Last reply
            0
            • M minhpc_bk

              Well-done, In fact, these two links don't give you a straight answer, but they do give you some ideas on how the controls work especially when they are dynamically added. Once you understand the life cycle of the control, things become much easier for you.

              H Offline
              H Offline
              Harmonium
              wrote on last edited by
              #6

              Thanks again for guiding me in the right direction. Hopefully I can return the favor one day.

              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