是否有一种方法可以注释掉.ASPX页面中的标记,这样它就不会被交付给客户端了?我已经尝试了标准注释<!-- -->,但这只是作为注释交付,并没有阻止控件的呈现。
当前回答
| ctrl + K, C是Visual Studio中的注释快捷键。ctrl + K, U取消注释。
其他回答
<%-- not rendered to browser --%>
我相信你在寻找:
<%-- your markup here --%>
这是一个服务器端注释,不会被传递到客户端…但这不是可选的。如果你需要这是可编程的,那么你会想要这个答案:-)
另一种方法是假设你想注释掉的不是服务器端代码……
<asp:panel runat="server" visible="false">
html here
</asp:panel>
虽然这是有效的:
<%-- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ht_tv1.Default" %> --%>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Blank._Default" %>
这个不会。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" <%--Inherits="ht_tv1.Default"--%> Inherits="Blank._Default" %>
所以你不能注释掉我99.9995%的时候都想做的事情。
| ctrl + K, C是Visual Studio中的注释快捷键。ctrl + K, U取消注释。
推荐文章
- 用c#解析JSON
- ASP是什么?NET Identity的IUserSecurityStampStore<TUser>接口?
- ASP。网网络。config: configSource vs.文件属性
- 在Linq中转换int到字符串到实体的问题
- <system. >之间的差异。web>和<system.webServer>?
- 为什么ASP。NET web表单需要Runat="Server"属性吗?
- 在VS Code中禁用“Comments are not allowed In JSON”错误
- 使用不同的Web。在开发和生产环境中进行配置
- Swift:理解// MARK
- 我如何添加双引号的字符串,是在一个变量?
- 最好的方法在asp.net强制https为整个网站?
- 在ASP .NET身份声明是什么
- 驻留在App_Code中的类不可访问
- 自定义HttpClient请求头
- 在构建中编写注释的语法是什么?gradle文件?