Update Panel with Master Page

Last post 08-18-2007 10:23 PM by Sheldon Penner. 4 replies.

Sort Posts:

  • Update Panel with Master Page

    08-18-2007, 4:45 PM

    I am just beginning to experiment with ASP.Net Ajax, and I have been attempting the "Using the ASP.Net UpdatePanel Control Panel with Master Pages" tutorial, with no success.

    I believe I have successfully downloaded and installed the AJAX Extensions and the AJAX toolkit -- my initial experiments updating a textbox inside an update panel run as expected.  However, when I attempt to incorporate Master pages, here's what happens:

    I created a Masterpage, AjaxTestPage.master, as described in the tutorial, with the following code:

    <%@ Master Language="VB" %>

    <!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">
        <title>Ajax Test Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" >
        </asp:ScriptManager>   
        <div>
        Master Page<hr />
            <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
            </asp:contentplaceholder>
        </div>
        </form>
    </body>
    </html>

    The problem occurs when I create a content page using the master page, using the following code:

    <%@ Page Language="VB" MasterPageFile="~/AjaxTestPage.master" Title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    Content Page
        <asp:UpdatePanel runat="server">
            <asp:Calendar runat="server"></asp:Calendar>
        </asp:UpdatePanel>

    </asp:Content>

    I get the dreaded squigglies beneath "UpdatePanel" and "Calendar", with error messages indicating that neither one is a "known element."

    I'd appreciate any thoughts on what I might be doing wrong.



     

     
  • Re: Update Panel with Master Page

    08-18-2007, 6:53 PM
    • Contributor
      2,847 point Contributor
    • klaus_b
    • Member since 05-03-2006, 1:11 PM
    • Bavaria, Germany
    • Posts 566

    Hi  Sheldon Penner,

    Sheldon Penner:

    The problem occurs when I create a content page using the master page, using the following code:

    <%@ Page Language="VB" MasterPageFile="~/AjaxTestPage.master" Title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <asp:UpdatePanel runat="server">
            <asp:Calendar runat="server"></asp:Calendar>
        </asp:UpdatePanel>
    
    </asp:Content>
     I get the dreaded squigglies beneath "UpdatePanel" and "Calendar", with error messages indicating that neither one is a "known element."

     

    You need a id for the elements and the ContentTemplate in your UpdatePanel eg

    <%@ Page Language="VB" MasterPageFile="~/AjaxTestPage.master" Title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <asp:UpdatePanel ID="up1" runat="server">
            <ContentTemplate>
                <asp:Calendar ID="cal1" runat="server"></asp:Calendar>
            </ContentTemplate>
        </asp:UpdatePanel>
    
    </asp:Content>
     
    										                
    										                
                									    
    Servus,
    Klaus

    I haven't the faintest idea, but great many therefrom.
    klaus_b@.NET
  • Re: Update Panel with Master Page

    08-18-2007, 9:06 PM
    Answer

    Thank you, Klaus.  My error was in leaving out the ContentTemplate tags.  It works now.

  • Re: Update Panel with Master Page

    08-18-2007, 9:40 PM
    • Contributor
      2,847 point Contributor
    • klaus_b
    • Member since 05-03-2006, 1:11 PM
    • Bavaria, Germany
    • Posts 566

    Sheldon Penner:

    My error was in leaving out the ContentTemplate tags.  It works now.

    And what i've written above? Wink

    Servus,
    Klaus

    I haven't the faintest idea, but great many therefrom.
    klaus_b@.NET
  • Re: Update Panel with Master Page

    08-18-2007, 10:23 PM

    What you wrote above was exactly right.  Thanks again.

Page 1 of 1 (5 items)