Craig
Craig

Reputation: 1794

LinkButton Click event ignored

I have the following Hyperlink as a button:-

<asp:LinkButton ID="loginButton" runat="server" CssClass="loginButton" Text="LOGIN" OnClientClick="return validateLogin(memNoID,pwID)" AddressOf="loginButton.Click"></asp:LinkButton>

It causes a postback but only executes the onload and prerender sections of code. It totally ignores the following function signature:-

Protected Sub loginButton_Click(ByVal sender As Object, ByVal e As EventArgs)

Some code

End Sub

Any pointers appreciated.

Upvotes: 0

Views: 752

Answers (2)

Jason M
Jason M

Reputation: 512

Did you try adding your _Click method to the OnClick event?

Upvotes: 0

wassertim
wassertim

Reputation: 3136

Add OnClick in your code:

<asp:LinkButton ID="loginButton" runat="server" CssClass="loginButton" Text="LOGIN" OnClientClick="return validateLogin(memNoID,pwID)" OnClick="loginButton_Click" AddressOf="loginButton.Click"></asp:LinkButton>

Upvotes: 2

Related Questions