My click events are firing on linkbuttons on page load, before the link has been clicked, any ideas? (This is in a Visual web-part hosted in SP2010)
This is my code:
<asp:LinkButton ID="LinkButtonA" PostBackUrl="<%#Request.Url.AbsoluteUri %>" runat="server" OnClick="Letter_Click" CommandArgument="A">A</asp:LinkButton>
protected void Letter_Click(object sender, EventArgs e)
{
if (IsPostBack)
{
Label1.Text = ((LinkButton)sender).CommandArgument;
}
}
Label1 is having its text set to 'A' on page load.