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;
}
}
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"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