locked
MasterPage ContentPlaceholder inside Update panel RRS feed

  • Question

  • User1280166163 posted

    I've created a master page that surrounds a contentplaceholder with an update panel:

    asp:updatepanel id="upMain" runat="server"

    ContentTemplate

    asp:ContentPlaceholder id="mainContent" runat="server"

    .../asp:ContentPlaceholder

    .../ContentTemplate

    .../asp:Updatepanel

    The website runs correctly, but every server control inside the content place holder in content pages is underlined and the 'element X is not a known element' error is listed in the Error List window. This applies to all server controls: textboxes, labels, etc.

    Tuesday, May 29, 2007 4:16 PM

Answers

  • User-1087479560 posted

    Hi,

    Basically, this should work. Here is a sample:

     

    <%@ Master Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
    
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
             
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
            <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
            </asp:contentplaceholder>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        </form>
    </body>
    </html>
    

     

     

    <%@ Page Language="C#" MasterPageFile="~/MasterPage2.master" Title="Untitled Page" %>
    
    <script runat="server">
    
        protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = DateTime.Now.ToString();
        }
    </script>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    </asp:Content>
    
    
      The controls inside it are all right.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 4, 2007 1:34 AM

All replies

  • User-1087479560 posted

    Hi,

    Basically, this should work. Here is a sample:

     

    <%@ Master Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
    
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
             
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
            <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
            </asp:contentplaceholder>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        </form>
    </body>
    </html>
    

     

     

    <%@ Page Language="C#" MasterPageFile="~/MasterPage2.master" Title="Untitled Page" %>
    
    <script runat="server">
    
        protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = DateTime.Now.ToString();
        }
    </script>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    </asp:Content>
    
    
      The controls inside it are all right.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 4, 2007 1:34 AM
  • User1843384928 posted

     I'm sorry, this did not work.

    I just tried and the whole thing did post back.

    now, it seems that the contentplaceholder is the problem.

    I'm i supposed to use any special pattern to solve this?

    Wednesday, November 28, 2007 2:41 PM
  • User1595717143 posted

     

    http://dennisv.net/2007/02/19/28/
    Tuesday, September 16, 2008 9:36 AM
  • User-2087919080 posted

    very nice, asasa 

    Saturday, October 31, 2009 1:17 PM
  • User-203893726 posted

    please have a look at my question regarding this issue here:

    http://forums.asp.net/t/1947180.aspx?MasterPage+ContentPlaceholder+inside+Update+panel

    thanks

    arik

    Thursday, October 31, 2013 4:33 AM