|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Find the source of an eventHi,
I'm trying to attach a code behind method to two different LinkButton controls on my page. How can I find out which of the controls fired up the event in the code behind method that handles the event? Thanks The Commnad event passes a parameter of type CommandEventArgs that has a
value for the CommandName attribute of the LinkButton control, e.g. <asp:LinkButton ID="LinkButton1" runat=server CommandName ="DeleteARecord" OnCommand ="LinkButtons_Command"></asp:LinkButton> <asp:LinkButton ID="LinkButton2" runat=server CommandName ="AddARecord" OnCommand ="LinkButtons_Command" ></asp:LinkButton> protected void LinkButtons_Command(object sender, CommandEventArgs e) { switch (e.CommandName) { case "DeleteARecord": //add code to delete break; case "AddARecord": //add code to add a record break; } } Show quoteHide quote "Vi" wrote: > Hi, > I'm trying to attach a code behind method to two different LinkButton > controls on my page. > > How can I find out which of the controls fired up the event in the code > behind method that handles the event? > > Thanks
ASP.NET 2.0 Menu Control - DynamicEnableDefaultPopOutImage Property
CSS class for a div tag Could not load type XXXXXX from assembly mscorlib Datagrid empty data hides header asp button click handler Tree View DragNode Low level programing in ASP .Net validation controls are not working Regular Expression Help Problem using login control |
|||||||||||||||||||||||