|
|
|
start date: Tue, 14 Aug 2007 18:30:37 -0000,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
unknown
|
|
2
Teemu Keiski
|
|
3
unknown
|
including comments in ASPX code that don't render to the client? (c# 2.0)
In .NET 2.0, is there any way to include comments in the aspx file
that do not get rendered to the client (ie no <!-- -->) ?
When I try to include C# comments in a code block in an aspx page,
like this:
<%
// *******************************************************
// CHANGE HISTORY:
// DATE USER CHANGE
// 08/14/2007 Tue ebloom updated logo
// *******************************************************
%>
I am getting an error
The Controls collection cannot be modified because the control
contains code blocks (i.e. <% ... %>).
It would seem this is because .NET doesn't like inline code (even
though it isn't really "code" we want to include, just comments).
Including these comments in the codebehind is not preferred because
the changes are specific to the ASPX page. Our site has multiple
versions of a given aspx for each language, ie
/en/mypage.aspx
/de/mypage.aspx
etc.
and the codebehind is stored in
/common/mypage.aspx.cs
Any help appreciated, thanks...
Date:Tue, 14 Aug 2007 18:30:37 -0000
Author:
|
Re: including comments in ASPX code that don't render to the client? (c# 2.0)
Hi,
<%--
Everything here is a comment
--%>
So basically in <%-- --%>
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
wrote in message
news:1187116237.144990.301740@o61g2000hsh.googlegroups.com...
> In .NET 2.0, is there any way to include comments in the aspx file
> that do not get rendered to the client (ie no <!-- -->) ?
>
> When I try to include C# comments in a code block in an aspx page,
> like this:
>
> <%
> // *******************************************************
> // CHANGE HISTORY:
> // DATE USER CHANGE
> // 08/14/2007 Tue ebloom updated logo
> // *******************************************************
> %>
>
> I am getting an error
>
> The Controls collection cannot be modified because the control
> contains code blocks (i.e. <% ... %>).
>
> It would seem this is because .NET doesn't like inline code (even
> though it isn't really "code" we want to include, just comments).
>
> Including these comments in the codebehind is not preferred because
> the changes are specific to the ASPX page. Our site has multiple
> versions of a given aspx for each language, ie
>
> /en/mypage.aspx
> /de/mypage.aspx
> etc.
>
> and the codebehind is stored in
>
> /common/mypage.aspx.cs
>
> Any help appreciated, thanks...
>
Date:Tue, 14 Aug 2007 21:48:29 +0300
Author:
|
Re: including comments in ASPX code that don't render to the client? (c# 2.0)
Aha - thanks!
PS I found more info on that here:
Tip/Trick: Using Server Side Comments with ASP.NET 2.0
http://weblogs.asp.net/scottgu/archive/2006/07/09/Tip_2F00_Trick_3A00_-Using-Server-Side-Comments-with-ASP.NET-2.0-.aspx
On Aug 14, 2:48 pm, "Teemu Keiski" wrote:
> Hi,
>
> <%--
> Everything here is a comment
> --%>
>
> So basically in <%-- --%>
>
> --
> Teemu Keiski
> AspInsider, ASP.NET MVPhttp://blogs.aspadvice.com/jotekehttp://teemukeiski.net
>
> wrote in message
>
> news:1187116237.144990.301740@o61g2000hsh.googlegroups.com...
>
> > In .NET 2.0, is there any way to include comments in the aspx file
> > that do not get rendered to the client (ie no <!-- -->) ?
>
> > When I try to include C# comments in a code block in an aspx page,
> > like this:
>
> > <%
> > // *******************************************************
> > // CHANGE HISTORY:
> > // DATE USER CHANGE
> > // 08/14/2007 Tue ebloom updated logo
> > // *******************************************************
> > %>
>
> > I am getting an error
>
> > The Controls collection cannot be modified because the control
> > contains code blocks (i.e. <% ... %>).
>
> > It would seem this is because .NET doesn't like inline code (even
> > though it isn't really "code" we want to include, just comments).
>
> > Including these comments in the codebehind is not preferred because
> > the changes are specific to the ASPX page. Our site has multiple
> > versions of a given aspx for each language, ie
>
> > /en/mypage.aspx
> > /de/mypage.aspx
> > etc.
>
> > and the codebehind is stored in
>
> > /common/mypage.aspx.cs
>
> > Any help appreciated, thanks...
Date:Tue, 14 Aug 2007 18:58:12 -0000
Author:
|
|
|