页面指​​令语法 [英] Page Directive Syntax

查看:54
本文介绍了页面指​​令语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以建议aspx页面的页面指令语法.
请告诉我们何时,何地以及在哪种情况下我们必须使用这种语法,如
<%#%> ;、<%@%>,<%=%>等等..

Can any one please suggest the Page Directive Syntax of aspx page.
Please tell When and where and in which scenario we have to use this syntax like
<%# %>, <%@ %>,<%= %> and so on..

推荐答案

它们被称为 MSDN:文本模板指令语法 [ ^ ]
<% %>:嵌入服务器端代码- MSDN:ASP.NET网页中的嵌入式代码块 [ ^ ]
<%= %>:代码表达式- MSDN:ASP.NET网页中的嵌入式代码块 [ ^ ]
<%: %>:HTML编码输出- ^ ]
<%# %>:数据绑定- Microsoft支持:数据绑定要领 [
They are called MSDN: Server-side scripting delimiters[^]

<%@ %>: Directive - MSDN: Text Template Directive Syntax[^]
<% %> : Embedd server side code - MSDN: Embedded Code Blocks in ASP.NET Web Pages[^]
<%= %> : Code Expression - MSDN: Embedded Code Blocks in ASP.NET Web Pages[^]
<%: %> : HTML Encoding Output - ASPNET Blog: Syntax for HTML Encoding Output [^]
<%# %> : Databinding - Microsoft support: Data binding essentials[^]
<%


%>:表达式- MSDN:ASP.NET表达式概述 [ MSDN:服务器端注释 [
%> : Expression - MSDN: ASP.NET Expressions Overview[^]
<%-- --%> : Server side comments - MSDN: Server-Side Comments[^]

Tried to find the related links along with them to have full understanding on their usage.


ASP.Net指令是用于指定可选设置的指令,例如注册自定义控件和页面语言.这些设置描述了.Net框架如何处理Web表单(.aspx)或用户控件(.ascx)页面.

声明指令的语法为:
ASP.Net directives are instructions to specify optional settings, such as registering a custom control and page language. These settings describe how the web forms (.aspx) or user controls (.ascx) pages are processed by the .Net framework.

The syntax for declaring a directive is:
<![CDATA[<%@  directive_name attribute=value  [attribute=value]  %>]]>



通用页面指令之一是母版页.主指令将页面文件指定为主页面. Herez示例代码:



One of the common page directive is masterpage. Master directive specifies a page file as being the mater page. Herez the sample code:

<%@ MasterPage Language="C#"  AutoEventWireup="true"

    CodeFile="SiteMater.master.cs" Inherits="SiteMaster"  %>


这篇关于页面指​​令语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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