ASP.NET“特殊"标签 [英] ASP.NET "special" tags

查看:21
本文介绍了ASP.NET“特殊"标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

像这样的特殊"ASP.NET 标签的正式名称是什么:

What is the official name for the "special" ASP.NET tags like this:

<%# %>
<%= %>
<%@ %>
<%$ %>

我似乎无法弄清楚这些概念的名称或众所周知的名称,因此我无法搜索更多信息.作为奖励,谁能给我一个所有可能的特殊标签"的简要概述以及它们每个人的作用(或指向我的资源)?

I can't seem to figure out the conceptual or well known name for these, so I'm having trouble searching for more info. As a bonus, can anyone give me a quick rundown of all of the possible "special tags" and what each one of them does (or point me to a resource)?

推荐答案

正式名称是服务器端脚本分隔符" 或 "ASP.NET 内联表达式".Visual Studio 2008 语法高亮设置对话框将这些称为HTML 服务器端脚本".微软的人在他们的博客中称他们为代码块".

The official name is "server-side scripting delimiters" or "ASP.NET inline expressions". Visual Studio 2008 syntax highlighting settings dialog calls these "HTML Server-Side Script". Microsoft guys call them "code nuggets" in their blogs.

  • <%@%> 是一个 ASP.NET 网页指令.用于页面和控件以配置页面/控件编译器设置(<%@ Control Inherits="MyParentControl" %>).
    • <%@ %> 也是一个 应用指令.用于为 global.asax 指定特定于应用程序的设置.与页面指令不同,因为它只使用不同的标签集.
    • <%@ %> is a Directive for ASP.NET Web Pages. Used for pages and controls to configure page/control compiler settings (<%@ Control Inherits="MyParentControl" %>).
      • <%@ %> is also an Application Directive. Used to specify application-specific settings for global.asax. Distinct from the page directives as it only uses a different tag set.

      还有一个代码声明块,最终的嵌入式代码块形式.

      There is also a Code Declaration Block, the final Embedded Code Block form.

      <script runat="server">
      bool IsTrue() {
        return false;
      }
      </script>
      

      这用于将附加成员(方法等)包含到从 ASP.NET 标记生成的类中.仅提供这些"主要是为了保持与旧 ASP 技术的向后兼容性",不推荐使用.

      This is used to include additional members (methods etc.) to the class generated from the ASP.NET markup. These have only ever been provided "primarily to preserve backward compatibility with older ASP technology" and are not recommended for use.

      这篇关于ASP.NET“特殊"标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆