I am using .net content place holders for a couple areas on my site. The majority of the time they will use one user control for the content. Is there a way in .NET to specify a "fallback" for a content place holder if nothing is passed in from a content page? The place holders are located in my Site.Master FYI
Thanks
This is exactly what <asp:ContentPlaceHolder>
tag was designed for. Place your default content in the master page, if you don't override the placeholder in a child page the default content is displayed eg
Master Page
<%@ Master Language="C#" %>
...
<asp:ContentPlaceHolder ID="MyPlaceHolder" runat="server">
<!-- default content -->
</asp:ContentPlaceHolder>
Child Page
<asp:Content ID="ChildPlaceHolder" ContentPlaceHolderID="MyPlaceHolder" Runat="Server">
<!-- override default content -->
</asp:Content>
Unless I've completely misunderstood what you mean, you can put default content within the <asp:ContentPlaceHolder>
element in the Master page. If the corresponding <asp:Content
element in the client page is not defined, then the default content will be used.
For example, in your Master page...
<asp:ContentPlaceHolder ID="myPlaceHolder" runat="server">
<b>Hello World</b>
</asp:ContentPlaceHolder>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.