Detect button clicked

J

John

Hi,

I would like to create an eventhandles that handles several different
buttons.

How can I detect which button was clicked on ?
I know it something with the sender ...

something like

Private sub Button_Click(ByVal sender as object, ByVal e as
system.EventArgs)

select case e

end select

End sub





Thank



John
 
J

John Devlon

Here's the solution



<asp:Button ID="btnFirst" runat="server" text="<<" Width="25px"
CommandName="First" />

<asp:Button ID="btnPrevious" runat="server" text="<" Width="25px"
CommandName="Prev" />

<asp:Button ID="btnNext" runat="server" text=">" Width="25px" CommandName="Next"
/>

<asp:Button ID="btnLast" runat="server" text=">>" Width="25px" CommandName="Last"
/>



Protected Sub NavigationButtons_Command(ByVal sender as object, _

ByVal e As
Systems.Web.UI.Webcontroles.CommandEventArgs) _

Handles btnFirst.Command,
btnPrevious.Command, _

btnNext.Command, btnLast.command



Select case e.commandName

case "First"

....

case "Prev"

....

End select

End sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top