ASP:
<asp:LinkButton ID="lbSave" OnClick="lbSave_Click" runat="server">Save</asp:LinkButton>
HTML:
<a id="ContentMain_lbSave" href="javascript:__doPostBack('ctl00$ContentMain$lbSave','')">Save</a>
Code-behind:
public void lbSave_Click(object sender, EventArgs e)
{
if (strP != "")
{
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "DiffUser", "showDiffUser();", true);
}
else
{
//do something else...
}
}
JQuery:
function showDiffUser() {
$("#dvHide").fadeIn("slow");
$("#backOverlay").fadeIn("slow");
}
When I click the button, I want the page to not do a postback and run the JQuery function. Instead, when I click the link it refreshes the page and then executes the JQuery function.
How can I prevent the postback.
I tried the following: onClientClick='javascript:void(0);'
but that doesn't execute the JQuery function.