PC Review


Reply
Thread Tools Rate Thread

Bug? ASP.Net 2 Title does not render text when it contains controls

 
 
Ian Dunkerly#
Guest
Posts: n/a
 
      11th Mar 2008
I am using .Net 2 SP1 and appear to have a problem with rendering titles,
when the title contains both text and a controls only the controls are
rendered.

This can be reproduced by creating a page with the following:

<%@ Page Language="C#" AutoEventWireup="true" %>

<html>
<head runat="server">
<title>Test<asp:Localize ID="Localize1" runat="server" Text="Hello"
/></title>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>

I would expect that TestHello would be rendered, but only Hello is rendered.

Is this a known bug, is there a hotfix?

Thanks

Ian

 
Reply With Quote
 
 
 
 
Michael Nemtsev [MVP]
Guest
Posts: n/a
 
      11th Mar 2008
Hello Ian Dunkerly#,

use the method call from title, like
<title><%= GetTitle() %></title>

where in your method return the string

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


I> I am using .Net 2 SP1 and appear to have a problem with rendering
I> titles, when the title contains both text and a controls only the
I> controls are rendered.
I>
I> This can be reproduced by creating a page with the following:
I>
I> <%@ Page Language="C#" AutoEventWireup="true" %>
I>
I> <html>
I> <head runat="server">
I> <title>Test<asp:Localize ID="Localize1" runat="server"
I> Text="Hello"
I> /></title>
I> </head>
I> <body>
I> <form id="form1" runat="server">
I> <div>
I> </div>
I> </form>
I> </body>
I> </html>
I>
I> I would expect that TestHello would be rendered, but only Hello is
I> rendered.
I>
I> Is this a known bug, is there a hotfix?
I>
I> Thanks
I>
I> Ian
I>


 
Reply With Quote
 
Michael Nemtsev [MVP]
Guest
Posts: n/a
 
      11th Mar 2008
Hello Ian Dunkerly#,

actually, u can put "Test" into another <asp:Localize> control and it will
be rendered

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


I> I am using .Net 2 SP1 and appear to have a problem with rendering
I> titles, when the title contains both text and a controls only the
I> controls are rendered.
I>
I> This can be reproduced by creating a page with the following:
I>
I> <%@ Page Language="C#" AutoEventWireup="true" %>
I>
I> <html>
I> <head runat="server">
I> <title>Test<asp:Localize ID="Localize1" runat="server"
I> Text="Hello"
I> /></title>
I> </head>
I> <body>
I> <form id="form1" runat="server">
I> <div>
I> </div>
I> </form>
I> </body>
I> </html>
I>
I> I would expect that TestHello would be rendered, but only Hello is
I> rendered.
I>
I> Is this a known bug, is there a hotfix?
I>
I> Thanks
I>
I> Ian
I>


 
Reply With Quote
 
Ian Dunkerly
Guest
Posts: n/a
 
      11th Mar 2008
Thanks for the replies.

I actually simplified the source to demonstrate the problem. You can use any
combination of controls and text and all the text will be stripped out.

I would have thought that the title control works in the same way as the
label control - you can set the text property, but if you add any controls
then the whole lot renders as a control hierarchy.

Ian

"Michael Nemtsev [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Ian Dunkerly#,
>
> actually, u can put "Test" into another <asp:Localize> control and it will
> be rendered
>
> ---
> WBR, Michael Nemtsev [.NET/C# MVP] :: blog:
> http://spaces.live.com/laflour
> "The greatest danger for most of us is not that our aim is too high and we
> miss it, but that it is too low and we reach it" (c) Michelangelo
>
> I> I am using .Net 2 SP1 and appear to have a problem with rendering
> I> titles, when the title contains both text and a controls only the
> I> controls are rendered.
> I> I> This can be reproduced by creating a page with the following:
> I> I> <%@ Page Language="C#" AutoEventWireup="true" %>
> I> I> <html>
> I> <head runat="server">
> I> <title>Test<asp:Localize ID="Localize1" runat="server"
> I> Text="Hello"
> I> /></title>
> I> </head>
> I> <body>
> I> <form id="form1" runat="server">
> I> <div>
> I> </div>
> I> </form>
> I> </body>
> I> </html>
> I> I> I would expect that TestHello would be rendered, but only Hello is
> I> rendered.
> I> I> Is this a known bug, is there a hotfix?
> I> I> Thanks
> I> I> Ian
> I>
>

 
Reply With Quote
 
Michael Nemtsev [MVP]
Guest
Posts: n/a
 
      11th Mar 2008
Hello Ian,

If you put your text into asp:Literal control its not stripped out

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


ID> simplified the source to demonstrate the problem. You can use any
ID> combination of controls and text and all the text will be stripped
ID> out.
ID>


 
Reply With Quote
 
Andrew Morton
Guest
Posts: n/a
 
      11th Mar 2008
If it's any help, you can do this to a <title>:
<title runat="server" id="title">A page</title>

and declare it in the code-behind as
Public title As System.Web.UI.HtmlControls.HtmlGenericControl

and set the text with
title.InnerHtml &= " title"

Andrew


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controls do not seem to render correctly Volker Lehmann Microsoft Dot NET Compact Framework 1 28th Jun 2006 02:08 AM
Controls don't render consistently. zeyais@gmail.com Microsoft ASP .NET 1 23rd Oct 2005 11:38 AM
Controls don't render =?Utf-8?B?QWJlUg==?= Microsoft Dot NET 6 11th Jun 2005 08:31 PM
ASP.NET Controls Don't Render =?Utf-8?B?S2FyZWVtIFNoYWtlcg==?= Microsoft ASP .NET 1 18th Mar 2004 08:00 PM
Controls don't render correctly in VS.NET with CSS Boris Zakharin Microsoft ASP .NET 0 6th Aug 2003 01:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:44 PM.