I am giving few step to achieve the goal.
Step 1.: Define three link buttons on .aspx page but these three have same
onclick
event so your .aspx page is :
<div>
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">LinkButton1</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton1_Click">LinkButton2</asp:LinkButton>
<asp:LinkButton ID="LinkButton3" runat="server" onclick="LinkButton1_Click">LinkButton3</asp:LinkButton>
</div>
Step 2: Now
onclick
event define on code behind page and in this event
sender
assign to a
LinkButton
that identifies which button clicked. Lets see this event
protected void LinkButton1_Click(object sender, EventArgs e)
{
LinkButton lnkButton = (LinkButton) sender;
if (lnkButton.ID == "LinkButton1")
{
Response.Write("Button First clicked");
}
else if (lnkButton.ID == "LinkButton2")
{
Response.Write("Button second clicked");
}
else
{
Response.Write("Button third clicked");
}
}