Define your event handler to match the signature for System.EventHandler.
Specify that your sub will handle the click event for each of your buttons.
CType() sender to LinkButton and retrieve the ID or the Text (if you haven't
defined an ID for each button). Use if blocks or select case to perform the
processing specific to a particular button.
example (sorry if my VB syntax is a little off):
protected sub linkButton_Click(Sender as Object, e as EventArgs)
if Not (Sender is LinkButton)
return
Dim lb as LinkButton = CType(Sender, LinkButton)
if lb.ID = "Button1" Then
'Processing for Button1
elseif lb.ID = "Button2" Then
'Processing for Button2
end if
' Any other code
end sub
If your linkbuttons are defined at design time, you could also just compare
sender to each linkbutton:
if Sender.Equals(Button1) Then
' Processing for button 1
elseif Sender.Equals(Button2) Then
' Processing for button 2
end if
HTH
----
http://www.davefancher.com
"WebBuilder451" wrote:
I have about 20 link buttons that i need handled by one sub. I don't want to
have 20 onClick_xxx subs or onCommand subs.
I'm not having much luck calling a single sub for all the button or figuring
out which button caused the event?
I'm sure this is a simple one for most of you.
thanks
kes
--
I figure if you can''t ask a question honestly, even if it suggests
blasphemy and disturbs the sensibilities of the grand masters of programming
you should quite and join a cult. kes