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 ;-) ?
Printable View
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 ;-) ?
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.
something like that, i didn't use a code editor so there may be a typo but you get the idea.VB Code:
Protected Sub btnSubmit_Click(ByVal sender as object, ByVal e As System.EventArgs) Dim btnSubmit As Button = CType(sender, Button) If Not btnSubmit Is Nothing Then Response.Write(btnSubmit.ID) End If End Sub
Great, thanks again