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 link btn

Dynamic link btn

Scheduled Pinned Locked Moved ASP.NET
databasetutorialquestion
10 Posts 5 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.
  • A Offline
    A Offline
    A Muthunagai
    wrote on last edited by
    #1

    HI, I Created link button dynamically. When I click the link button it ill display the corresponding details which i stored in database. How to do that? Thanks in advance

    N I C 3 Replies Last reply
    0
    • A A Muthunagai

      HI, I Created link button dynamically. When I click the link button it ill display the corresponding details which i stored in database. How to do that? Thanks in advance

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

      Muthunagai.A wrote:

      When I click the link button it ill display the corresponding details which i stored in database.

      You need to attach click event for that link button.


      My Website | Ask smart questions

      A 1 Reply Last reply
      0
      • N N a v a n e e t h

        Muthunagai.A wrote:

        When I click the link button it ill display the corresponding details which i stored in database.

        You need to attach click event for that link button.


        My Website | Ask smart questions

        A Offline
        A Offline
        A Muthunagai
        wrote on last edited by
        #3

        The List of Question and answers are stored in Database. Questions are all in link button. When i click the Question then only the answer will display. Final output like this Q: 1234? ---> link button A: answer Can u give me any idea? or sample? how to do this?

        N 1 Reply Last reply
        0
        • A A Muthunagai

          The List of Question and answers are stored in Database. Questions are all in link button. When i click the Question then only the answer will display. Final output like this Q: 1234? ---> link button A: answer Can u give me any idea? or sample? how to do this?

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

          Are you using Datagrid to show questions ? If yes you can make use button column. Make button type as link button, which will be rendered as HTML Link. Set command name property of button column. When user clicks link button, ASP.NET will fire ItemCommand event. You need to check the command inside this event to ensure that it is coming from your link button. Now get question id from the grid bound columns and query to database with this id for getting relevant answers.


          My Website | Ask smart questions

          H A 2 Replies Last reply
          0
          • N N a v a n e e t h

            Are you using Datagrid to show questions ? If yes you can make use button column. Make button type as link button, which will be rendered as HTML Link. Set command name property of button column. When user clicks link button, ASP.NET will fire ItemCommand event. You need to check the command inside this event to ensure that it is coming from your link button. Now get question id from the grid bound columns and query to database with this id for getting relevant answers.


            My Website | Ask smart questions

            H Offline
            H Offline
            hello reddy
            wrote on last edited by
            #5

            :laugh:;);P:^):sigh::confused:

            1 Reply Last reply
            0
            • N N a v a n e e t h

              Are you using Datagrid to show questions ? If yes you can make use button column. Make button type as link button, which will be rendered as HTML Link. Set command name property of button column. When user clicks link button, ASP.NET will fire ItemCommand event. You need to check the command inside this event to ensure that it is coming from your link button. Now get question id from the grid bound columns and query to database with this id for getting relevant answers.


              My Website | Ask smart questions

              A Offline
              A Offline
              A Muthunagai
              wrote on last edited by
              #6

              No, I'm not using the Datagrid. I'm using Panel to show the result. Sorrry, now tell me? how to do that?

              1 Reply Last reply
              0
              • A A Muthunagai

                HI, I Created link button dynamically. When I click the link button it ill display the corresponding details which i stored in database. How to do that? Thanks in advance

                I Offline
                I Offline
                Imran Khan Pathan
                wrote on last edited by
                #7

                1 .Take datagrid. 2. Take LinkButton in ItemTemplate and bind it with Question field. 3 take DIV and apply style display:none property 3. Take Label Control in div tag and Bind it with Answer field 4. Now call javascript function on LinkButton to display or hide Answer field Best Regard Pathan

                ---------------------------------------------------

                1 Reply Last reply
                0
                • A A Muthunagai

                  HI, I Created link button dynamically. When I click the link button it ill display the corresponding details which i stored in database. How to do that? Thanks in advance

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

                  The trick is, if you dynamically create any controls, they need to be created before page_load, so that their viewstate is restored, and you get their events and values back.

                  Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                  A 1 Reply Last reply
                  0
                  • C Christian Graus

                    The trick is, if you dynamically create any controls, they need to be created before page_load, so that their viewstate is restored, and you get their events and values back.

                    Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                    A Offline
                    A Offline
                    A Muthunagai
                    wrote on last edited by
                    #9

                    Thank you. But I want to do it in a button click event.Is it possible? I have to edit the question & answer and store it to the database. Thanks in advance

                    C 1 Reply Last reply
                    0
                    • A A Muthunagai

                      Thank you. But I want to do it in a button click event.Is it possible? I have to edit the question & answer and store it to the database. Thanks in advance

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

                      It doesn't matter where you create it the first time, so long as it's recreated before page_load on postback.

                      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                      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