1

I need to load pages asynchronously using asp.net C#. I have a master with Two(2) hyperlink controls and One(1) ContentPlaceHolder. I do not need page refresh or mute the page refresh to load page Async by clicking the hypelink control given on master page. Code for Main.Master page, Home.aspx page and the products.aspx is given below.

Main.Master

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Main.master.cs" Inherits="AsyncPageLoadFromMasterLink.Main" %>
<!DOCTYPE html>
    <html>
        <head runat="server">
            <title></title>
        </head>
        <body>
            <form id="form1" runat="server">
                <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
                <div id="navbar">
                    <asp:HyperLink ID="lnkHome" NavigateUrl="~/home.aspx" runat="server">Home</asp:HyperLink>
                    <br />
                    <asp:HyperLink ID="lnkProducts" NavigateUrl="~/products.aspx" runat="server">Products</asp:HyperLink>
                </div>
                <div id="main">
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                            </asp:ContentPlaceHolder>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
            </form>
        </body>
        </html>

home.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="home.aspx.cs" Inherits="AsyncPageLoadFromMasterLink.home" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>This is Home Page</h1>
</asp:Content>

products.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="products.aspx.cs" Inherits="AsyncPageLoadFromMasterLink.products" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>This is Products page</h1>
</asp:Content>

Bundle of Thanks in Advance

1 Answer 1

1

I bet you need to add the hyperlinks to the update panel and bind the hyperlink's OnClick() event to the update panel's trigger.

Sign up to request clarification or add additional context in comments.

2 Comments

it is just blueprint, I have developed a management system which has a navigation-bar, so I need to navigate asynchronously between .aspx page from my site's top navigation-bar. when I do this, the Visual Studio intellisense alert me with green line that you can not use any <DIV> tag inside update-panel. Hope you will better understand my purpose of doing that.
I understand now what you are asking. Thanks for the clarification. You might be able to do something like this using a a script manager. I can speak about that as I have no experience doing what you are asking in web forms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.