zoukankan      html  css  js  c++  java
  • C# asp.net页面常用语法,页面包含

    搞.net开发这么多年,知道和用过包含include指令吗?

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Syntax.aspx.cs" Inherits="HitCounter.MyTests.Syntax" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            from: <a href="http://quickstarts.asp.net/QuickStartv20/aspnet/doc/pages/syntax.aspx">来源</a>
            <br />
        <div>
            1. 数据绑定语法:&lt;%# %&gt;
              <br /><br />
            <asp:DataList ID="MyList" runat="server">
                <ItemTemplate>
                    Here is a value: <%# Container.DataItem %>
                </ItemTemplate>
            </asp:DataList>
            <hr />
    
            2. 转义语法: &lt;%: %&gt;
            <h1>
            <%: "<b>Hello,来自主页</b>" %>
            </h1>
            <hr />
    
            3. 这是服务器端的包含语法<br /><br />
            <!-- #Include File="SubContent.html" -->
            <!-- #Include File="SubForm.aspx" -->
            <hr />
    
            4.引用资源配置的语法 &lt;%$ ... %&gt; <br /><br />
            Expression Syntax: &lt;%$ ... %&gt; New in 2.0 ASP.NET 2.0 adds a new declarative expression syntax for substituting values into a page before the page is parsed. This is useful for substituting connection string values or application settings defined in a Web.config file for server control property values. It can also be used to substitute values from a resource file for locaization. More on connection string and resources expressions and expression handlers can be found in the Performing Data Access, Internationalizing Your Application and Extending ASP.NET sections.
            <br />
            <br />
            &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="&lt;%$ connectionStrings:Pubs %&gt;" SelectCommand="sp_GetAuthors" /&gt;
            <br />
            <br />
            &lt;asp:Label ID="Label1" runat="server" Text="&lt;%$ Resources: ExchRate, ConvertLabel %&gt;" /&gt; </div>
            <br /><br />
        </form>
    </body>
    </html>
  • 相关阅读:
    jquery 内容选择器
    jquery 子选择器
    jquery 基础选择器
    jquery 基础过滤器
    jdk1.8+SpringAOP注解报java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut select错误的不知原因的解决办法[仅供参考]
    [Spring]@Autowired,@Required,@Qualifier注解
    [Spring]IOC控制反转和DI依赖注入
    [LeetCode]无重复字符的最长子串
    Spring-代理模式
    Spring-使用注解开发
  • 原文地址:https://www.cnblogs.com/wucg/p/4008130.html
Copyright © 2011-2022 走看看