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. how to identify the button was clicked...

how to identify the button was clicked...

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestion
7 Posts 4 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
    hi_everybody
    wrote on last edited by
    #1

    hi, i added button into gridview at designtime in first column. after running the application if gridview get populated with data. suppose it contain 4 rows. if user click on button of 2nd row,i want show the message that you clicked 2nd row. i.e. according to clicking of button i want to show the message of which row was clicked. but how can i identify which button was clicked.... please, help me....

    D B N 3 Replies Last reply
    0
    • H hi_everybody

      hi, i added button into gridview at designtime in first column. after running the application if gridview get populated with data. suppose it contain 4 rows. if user click on button of 2nd row,i want show the message that you clicked 2nd row. i.e. according to clicking of button i want to show the message of which row was clicked. but how can i identify which button was clicked.... please, help me....

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      In the OnRowCreated event, assign the javascript click event and send the row index to it. That index you can then access in the server side click event through a hidden field.

      "No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem

      N 1 Reply Last reply
      0
      • H hi_everybody

        hi, i added button into gridview at designtime in first column. after running the application if gridview get populated with data. suppose it contain 4 rows. if user click on button of 2nd row,i want show the message that you clicked 2nd row. i.e. according to clicking of button i want to show the message of which row was clicked. but how can i identify which button was clicked.... please, help me....

        B Offline
        B Offline
        Brij
        wrote on last edited by
        #3

        do you want to show the alert from javascript?

        Cheers!! Brij

        1 Reply Last reply
        0
        • D dan sh

          In the OnRowCreated event, assign the javascript click event and send the row index to it. That index you can then access in the server side click event through a hidden field.

          "No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Use a button column and you don't need to do any of this.


          I know the language. I've read a book. - _Madmatt

          1 Reply Last reply
          0
          • H hi_everybody

            hi, i added button into gridview at designtime in first column. after running the application if gridview get populated with data. suppose it contain 4 rows. if user click on button of 2nd row,i want show the message that you clicked 2nd row. i.e. according to clicking of button i want to show the message of which row was clicked. but how can i identify which button was clicked.... please, help me....

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            Use a button column or template column and specify the onclick even handler for client-side processing or handle the event on the server-side


            I know the language. I've read a book. - _Madmatt

            H 1 Reply Last reply
            0
            • N Not Active

              Use a button column or template column and specify the onclick even handler for client-side processing or handle the event on the server-side


              I know the language. I've read a book. - _Madmatt

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

              ya i used template column for the button and assign the event handler. and when i clicked on button it goes to that event. but i want to know the row index of that row where the button is located(which get clicked) can you provid me code ..... actualy, i am showing the booking status in that gridview,first the status is 'in process' after clicking on button which is in gridview, it should the modal popup,in modal popup after clicking on 'ok' button, the status of booking should replaced with 'cancel req.' and for this purpose i want to know the row index of that gridview... so please, help me...

              modified on Thursday, February 11, 2010 12:34 AM

              H 1 Reply Last reply
              0
              • H hi_everybody

                ya i used template column for the button and assign the event handler. and when i clicked on button it goes to that event. but i want to know the row index of that row where the button is located(which get clicked) can you provid me code ..... actualy, i am showing the booking status in that gridview,first the status is 'in process' after clicking on button which is in gridview, it should the modal popup,in modal popup after clicking on 'ok' button, the status of booking should replaced with 'cancel req.' and for this purpose i want to know the row index of that gridview... so please, help me...

                modified on Thursday, February 11, 2010 12:34 AM

                H Offline
                H Offline
                hi_everybody
                wrote on last edited by
                #7

                thanks to all of you by helping me i the problem get solved by me... i get the rowindex of the button by rowIndex of button's parent's parent this is written at the event which is assigned to the button at design time in template column... i.e. Protected Sub btnCancelClick(ByVal sender As Object, ByVal e As System.EventArgs) Dim intRowIndex as Integer=sender.Parent.Parent.RowIndex End Sub :) BUT THANKSSSS To all of 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