Click here to Skip to main content
15,885,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a .net 3.5 website in which I'm having several .aspx pages using a single master page. I'm facing an issue every time the pages are redirected.

I have a header in the master page where the title of website is displayed as image.

beneath that I have a content placeholder where all the content pages are displayed.

Now, I have a button in content page1 which redirects to content page2. When I click on the button it is redirecting to page 2 but the whole master page is posting back to the server. What I need is the content page only need to be posted back. posting back of master page should be avoided.

Please help me in this regard.
below is the markup of my master page.

XML
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="Site" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
<link href="StyleSheets/StyleMaster.css" rel="Stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
<table id="tblMasterHeader" class="headBar" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td class="headLogo">
                <asp:HyperLink ID="HomeLink" runat="server" NavigateUrl="Aboutus.aspx" BorderStyle="None"
                    BorderWidth="0px">
                    <asp:Image ID="Image1" ImageUrl="Images/Masterpage/Logo1.png" BorderStyle="None"
                        runat="server" />
                </asp:HyperLink>
            </td>
            <td style="height: 100%">
                <table width="100%" border="0" style="height: 100%">
                    <tr>
                        <td class="aboveMenuBar">
                            <%--Top space--%>
                            <label id="lblTime" runat="server">
                            </label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%--Menu Bar--%>
                            <asp:Menu ID="mnuMain" runat="server" Orientation="Horizontal" DataSourceID="SiteMapMain"
                                StaticItemFormatString="//{0} &nbsp;&nbsp;&nbsp; ">
                                <StaticHoverStyle CssClass="MenuControlNoHover" />
                            </asp:Menu>
                            <asp:SiteMapDataSource ID="SiteMapMain" runat="server" ShowStartingNode="False" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
        </tr>
    </table>
    <table class="MasterContent">
        <tr>
            <td class="MasterLeftPanel">
                This is left panel
            </td>
            <td valign="top">
                <asp:ContentPlaceHolder ID="MainContent" runat="server">
                </asp:ContentPlaceHolder>
            </td>
        </tr>
    </table>
    <table class="MasterFooter">
        <tr>
            <td>
                This is footer
            </td>
        </tr>
    </table>
    </form>
</body>
</html>


Please help me.
Thanks in anticipation.
Posted

1 solution

If you mean you only want one part of the page updated (instead of the whole thing) you will need to use AJAX to provide partial page rendering.
This[^] is a microsoft tutorial on how to achieve it.
 
Share this answer
 
Comments
Sri9797 12-May-11 8:30am    
Hi Keith, but I tried the same example. and no use.
Sri9797 12-May-11 8:30am    
Thanks for ur prompt reply

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900