Monday, March 26, 2012

Updating ContentPlaceHolder using UpdatePanel(like using frames)

Hi guys,

Is there a way to update the whole Content page without master page refreshing it self? like same effect as using frames or iframes in html.

I tried following, just simply placing script manager and wrapping ContentPlaceHolder with UpdatePanel, which didn't work.

Any suggestions?


<%@dotnet.itags.org. Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="Site" %>
<html>
<head runat="server">
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
<div id="main"
<div id="titleBar">Title</div>

<div id="siteMenu">
<asp:Menu ID="Menu1" runat="server" SkinID="MenuBar" DataSourceID="SiteMapDataSource1" OnMenuItemClick="Menu1_MenuItemClick">
</asp:Menu>
</div>


<div id="content">

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate
<asp:contentplaceholder id="contents" runat="server"></asp:contentplaceholder>


</ContentTemplate>
</asp:UpdatePanel>
</div>


<div id="footer">footer</div
</div
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</form>
</body>
</html>



Sorry to say that master pages and AJAX don't work together in that fashion (seehttp://odetocode.com/Blogs/scott/archive/2007/01/03/9682.aspx).

There are lots of ways to refresh the content inside of the page using AJAX, but what you are trying to do requires the browser to load an entirely new page. :/


Thanks Scott.

I won't be wasting any more time trying to figure that one out.

Guess I am back to using good old Iframe.

Cheers

Dosa.

No comments:

Post a Comment