0
votes

I have a master page "PartialUpdate.Master" and 2 simple content pages "WebForm1.aspx" and "WebForm2.aspx"

WebForm1.aspx/WebForm2.aspx: the content-pages just display their filename

The master page "PartialUpdate.Master" has 2 buttons and a ContentPlaceHolder in an UpdatePanel. When clicking on a button I want to see the corresponding content-page

Here's what it looks like...

PartialUpdate.Master :

<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        Master Page  
        <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" 
        runat="server">
            <ContentTemplate>
                <asp:Button ID="btnForm1" CommandArgument="WebForm1.aspx" 
                runat="server"  Text="Form1"                                    OnClick="ChangeForm_Click" />
               <asp:Button ID="btnForm2" CommandArgument="WebForm2.aspx" 
                runat="server" Text="Form2" 
                OnClick="ChangeForm_Click" />
                <hr />
                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
            </asp:ContentPlaceHolder>
        </ContentTemplate>
        <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnForm1" 
                EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnForm2" 
                EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    </div>
    </form>
</body>

The code behind of PartialUpdate.Master.cs

    protected void ChangeForm_Click(object sender, EventArgs e)
    {
        Button btn = sender as Button;
        Response.Redirect(btn.CommandArgument);
    }

Problem here is that Response.Redirect() triggers a full-page postback. I just want the Master to refresh the content located in the 'ContentPlaceHolder' asynchronously (that's why I added the AJAX UpdatePanel)

In other words, I'd like to dynamically change the content-page that the Master is displaying whitout causing a full-page postback.

Is this possible? If so how?

thank you Chris

1

1 Answers

0
votes

You can call with WebRequest in ajax call and write the content you recieve to the page... But you can`t "knowing" the browser that you want to redirect to another page without post back.