C# asp.net頁面常用文法,頁麵包含

來源:互聯網
上載者:User

標籤:style   blog   http   color   io   ar   for   資料   sp   

搞.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>

 

C# asp.net頁面常用文法,頁麵包含

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.