Results 1 to 3 of 3

Thread: Last button clicked?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Question Last button clicked?

    I do remember, that I've seen a post regarding this subject, but I can't find the post when I search.
    I need the id of the last button that was clicked on the web form, how do I do that in a nice way ;-) ?

  2. #2
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fort Collins, CO
    Posts
    366
    Are you using eventhandlers for your buttons? If you have one event handler per button, then the id should be part of the name of the eventhandler name, if not, or if you have a global event handler to handle any button clicks, cast the sender as a button and grab the id from there.
    VB Code:
    1. Protected Sub btnSubmit_Click(ByVal sender as object, ByVal e As System.EventArgs)
    2.   Dim btnSubmit As Button = CType(sender, Button)
    3.   If Not btnSubmit Is Nothing Then
    4.     Response.Write(btnSubmit.ID)
    5.   End If
    6. End Sub
    something like that, i didn't use a code editor so there may be a typo but you get the idea.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049
    Great, thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width