PDA

View Full Version : [CLOSED] ResourceManager in master page prevent content page's title



hdsoso
Oct 15, 2013, 2:26 PM
master page


<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="extdemo.Site1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="images/style.css" rel="stylesheet" />
<script src="images/jquery.js"></script>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" SourceFormatting="True"></ext:ResourceManager> // if i remove this , content page 's title show


sub master page:


<%@ Master Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="article.master.cs" Inherits="extdemo.article" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<asp:ContentPlaceHolder runat="server" ID="cph_h"></asp:ContentPlaceHolder>
</asp:Content>

CONTENT PAGE :


<%@ Page Title="" Language="C#" MasterPageFile="~/article.master" AutoEventWireup="true" CodeBehind="article.aspx.cs" Inherits="extdemo.article1" %>


<asp:Content ID="Content1" ContentPlaceHolderID="cph_h" runat="server">
<title>XXX, here i set title , does not show,</title>
</asp:Content>


i want to add resourcemanager to master page , so i do not need to add it to all page, but it prevent content page's title?
what is the best way to do it?

hdsoso
Oct 15, 2013, 2:43 PM
i have tested it . as long as place ext:ResourceManager on the page , the page's title disappear, is it a bug?

geoffrey.mcgill
Oct 15, 2013, 4:16 PM
We have reproduced this issue and are continuing to investigate.

Thanks for reporting.

Daniil
Oct 15, 2013, 4:24 PM
Hi @hdsoso,

ASP.NET renders two title tags with your configuration.

We would suggest to avoid it having an individual ContentPlaceHolder for the title, this way:

In MasterPage

<title>
<asp:ContentPlaceHolder ID="title" runat="server" />
</title>

In ContentPage

<asp:Content ContentPlaceHolderID="title" runat="server">My Title</asp:Content>

hdsoso
Oct 15, 2013, 5:33 PM
Hi @hdsoso,

ASP.NET renders two title tags with your configuration.
[/CODE]
where renders two title?

hdsoso
Oct 15, 2013, 5:35 PM
Hi @hdsoso,

ASP.NET renders two title tags with your configuration.

We would suggest to avoid it having an individual ContentPlaceHolder for the title, this way:

In MasterPage

<title>
<asp:ContentPlaceHolder ID="title" runat="server" />
</title>

In ContentPage

<asp:Content ContentPlaceHolderID="title" runat="server">My Title</asp:Content>



<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="extdemo.Site1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="images/style.css" rel="stylesheet" />
<script src="images/jquery.js"></script>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<title>
<asp:ContentPlaceHolder ID="title" runat="server" />
</title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server"></ext:ResourceManager>




<%@ Master Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="article.master.cs" Inherits="extdemo.article" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<asp:ContentPlaceHolder runat="server" ID="cph_h"></asp:ContentPlaceHolder>
</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="title">
<asp:ContentPlaceHolder runat="server" ID="cph_title"></asp:ContentPlaceHolder>
</asp:Content>




<%@ Page Title="" Language="C#" MasterPageFile="~/article.master" AutoEventWireup="true" CodeBehind="article.aspx.cs" Inherits="extdemo.article1" %>


<asp:Content ID="Content1" ContentPlaceHolderID="cph_h" runat="server">

</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="cph_title">
my title
</asp:Content>


i use code above , does not work.

Baidaly
Oct 15, 2013, 11:01 PM
Hello!

You should either use Title attribute of Page:


<%@ Page Language="C#" Title="My Title" />

or use the solution suggested by @Daniil but remove Title attribute from Page declaration:


<%@ Page Language="C#" />

Vladimir
Oct 16, 2013, 5:36 AM
where renders two title?

Just remove Ext.Net widgets from the page and see generated html in browser, you will see tw titles tags in the head

hdsoso
Oct 16, 2013, 8:06 AM
Just remove Ext.Net widgets from the page and see generated html in browser, you will see tw titles tags in the head

ok, two title problem resolved ,
but as long as place ext:ResourceManager on the page , the page's title disappear, is it a bug? it is a key issue because i want to use ext.net on normal aspx page.

Vladimir
Oct 16, 2013, 8:14 AM
Do you mean that page renders one title only but the title is disappeared if there is ResourceManager? Can you post your test case?

hdsoso
Oct 16, 2013, 8:41 AM
Do you mean that page renders one title only but the title is disappeared if there is ResourceManager? Can you post your test case?

MASTER PAGE


<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="TobrosCWT.test.Site1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" SourceFormatting="True"></ext:ResourceManager>
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>


nest master page


<%@ Master Language="C#" MasterPageFile="~/test/Site1.Master" AutoEventWireup="true" CodeBehind="NestedMasterPage1.master.cs" Inherits="TobrosCWT.test.NestedMasterPage1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<asp:ContentPlaceHolder runat="server" ID="head1"></asp:ContentPlaceHolder>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>


content page


<%@ Page Language="C#" MasterPageFile="~/test/NestedMasterPage1.master" AutoEventWireup="true" CodeBehind="WebForm25.aspx.cs" Inherits="TobrosCWT.test.WebForm25" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head1" runat="server">
<title>my title </title>
</asp:Content>


my title does not show until i remove the


<ext:ResourceManager runat="server" SourceFormatting="True"></ext:ResourceManager>

in the Site1.master page , i have remove the title tag on the two master page.

Vladimir
Oct 16, 2013, 8:48 AM
Please Daniil's answer, you have to place title tag in main master page and add ContentPlaceholder inside title tag

michaeld
Oct 16, 2013, 9:12 AM
If this is the same issue I had, this may be related to the two title bug in an asp.net.

http://stackoverflow.com/questions/2102321/duplicate-title-tags-using-asp-net-masterpage

hdsoso
Oct 16, 2013, 10:40 AM
Please Daniil's answer, you have to place title tag in main master page and add ContentPlaceholder inside title tag

does not work , please check my example


<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="TobrosCWT.test.Site1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>
<asp:ContentPlaceHolder runat="server" ID="title"></asp:ContentPlaceHolder>-<asp:Literal runat="server" Text="-首页"></asp:Literal>
</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" SourceFormatting="True"></ext:ResourceManager>
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>





<%@ Master Language="C#" MasterPageFile="~/test/Site1.Master" AutoEventWireup="true" CodeBehind="NestedMasterPage1.master.cs" Inherits="TobrosCWT.test.NestedMasterPage1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">
<asp:ContentPlaceHolder runat="server" ID="title1"></asp:ContentPlaceHolder>-栏目页
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>





<%@ Page Title="" Language="C#" MasterPageFile="~/test/NestedMasterPage1.master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TobrosCWT.test.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title1" runat="server">
内容页
</asp:Content>


i remove the Title="" in content page , also does not work ,
but if i remove the ext:resource , it is ok , and i see the source of html , there is no two title tag .
please modify my test case , notice i use nested mater page . thanks .

Daniil
Oct 16, 2013, 1:37 PM
Thank you for the test case. Indeed, it reproduces the issue. Yesterday, I tested with a similar one, but it didn't reproduce. Not sure, why. Never mind.

We committed something to the trunk. It should fix the issue, please update.