By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,466 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,466 IT Pros & Developers. It's quick & easy.

Detect button clicked

P: n/a

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


Nov 4 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Hi,

I found it myself

Nov 4 '07 #2

P: n/a
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


Nov 4 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.