Comment

S

simon

If I try to comment some fields with <!--:

<!--<asp:TemplateColumn>
<HeaderTemplate>
<asp:Button ID="btnNew" CommandName="newType" Text="New Type" Runat="server"></asp:Button>
</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton text="DELETE" Visible='<%# Container.DataItem( "brisi" ) %>' CommandName="Delete" CommandArgument='<%# Container.DataItem( "mType_id" ) %>' Runat="server" ID="Linkbutton1"/>
</ItemTemplate>
</asp:TemplateColumn>-->

i get an error message:

Literal content ('<!--') is not allowed within a 'System.Web.UI.WebControls.DataGridColumnCollection'.


Any solution?

thank you,
Simon
 
K

Karl Seguin

It's important to understand the order of processing. <!--asp:TemplateColumn... is processed by the asp.net engine on the server side...and indeed <!-- is invalid asp.net code..

in normal HTML, when you do <!-- it sends it out to the browser and the browser choses not to display it (but you can still see the code via view source).

instead, try:

<asp:TemplateColumn visible="false">
....
</asp:..>

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


If I try to comment some fields with <!--:

<!--<asp:TemplateColumn>
<HeaderTemplate>
<asp:Button ID="btnNew" CommandName="newType" Text="New Type" Runat="server"></asp:Button>
</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton text="DELETE" Visible='<%# Container.DataItem( "brisi" ) %>' CommandName="Delete" CommandArgument='<%# Container.DataItem( "mType_id" ) %>' Runat="server" ID="Linkbutton1"/>
</ItemTemplate>
</asp:TemplateColumn>-->

i get an error message:

Literal content ('<!--') is not allowed within a 'System.Web.UI.WebControls.DataGridColumnCollection'.


Any solution?

thank you,
Simon
 
G

Greg Burns

Just saw the other day somebody suggesting using <%-- and --%> with server controls. Never tried it myself.

Greg


It's important to understand the order of processing. <!--asp:TemplateColumn... is processed by the asp.net engine on the server side...and indeed <!-- is invalid asp.net code..

in normal HTML, when you do <!-- it sends it out to the browser and the browser choses not to display it (but you can still see the code via view source).

instead, try:

<asp:TemplateColumn visible="false">
...
</asp:..>

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


If I try to comment some fields with <!--:

<!--<asp:TemplateColumn>
<HeaderTemplate>
<asp:Button ID="btnNew" CommandName="newType" Text="New Type" Runat="server"></asp:Button>
</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton text="DELETE" Visible='<%# Container.DataItem( "brisi" ) %>' CommandName="Delete" CommandArgument='<%# Container.DataItem( "mType_id" ) %>' Runat="server" ID="Linkbutton1"/>
</ItemTemplate>
</asp:TemplateColumn>-->

i get an error message:

Literal content ('<!--') is not allowed within a 'System.Web.UI.WebControls.DataGridColumnCollection'.


Any solution?

thank you,
Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top