Reputation: 286
i want load the page using anchor tag like this go from any content page. i want to prevent page refresh on anchor tag Click but at same time it should load Different page. example below here is content page
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<a href="WebForm2.aspx">go</a>
</asp:Content>
and on master Page
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>
Upvotes: 3
Views: 1248
Reputation: 517
Below will not work on server side Controls, also you need to change all content pages into individual.
$('a').click(function (e) {
var page = $(this).attr('href');
if (page!='#') {
window.history.pushState("string", "Title", page);
$("#divid").load(page, function () {
//write your stuff
});
}
e.preventDefault();
e.stopPropagation();
return false;
});
Upvotes: 2
Reputation: 56
<a class="link1" href="WebForm2.aspx">go</a>
<script>
$(function(){
$("a.link1").click(function()
{
$.get("WebForm2.aspx" );
return false; // prevent default browser refresh on "#" link
});
});
</script>
Upvotes: 2