I have a link on the page and i want when the user is pressing it, to evaluate a method where i check if the usser is logged in. If not, i want to show up a modal popup.
I know how to do the back-end checking and how to redirect the user but i have problems
with the link button:
<asp:LinkButton ID="LinkButton1" runat="server"
OnClientClick="redirectToWishList()">LinkButton</asp:LinkButton>
When i press it, it does a full postback instead evaluating the method where i show up the modal pop.
Do you have any workaround to not fire a full postback but check the method where i am doing the redirect?
Ps: The method which has to fire:
public void redirectToWishList(object sender, EventArgs e)
{
ASP.usercontrols_loginpopup_ascx loginUserControl = (ASP.usercontrols_loginpopup_ascx)UtilsStatic.FindControlRecursive(Page, "loginPopUp");
ModalPopupExtender modal = (ModalPopupExtender)loginUserControl.FindControl("loginPopUp");
modal.Show();
}
You need to call redirectToWishList as a function (including the parens): redirectToWishList()
Also, if you return false in your function, you do not need to in the tag.
UPDATE
I misunderstood. The OnClientClick is for invoking JavaScript, not running methods in your code-behind. You need to OnClick instead.