• <legend id='wqpaF'><style id='wqpaF'><dir id='wqpaF'><q id='wqpaF'></q></dir></style></legend>
    • <bdo id='wqpaF'></bdo><ul id='wqpaF'></ul>
    <i id='wqpaF'><tr id='wqpaF'><dt id='wqpaF'><q id='wqpaF'><span id='wqpaF'><b id='wqpaF'><form id='wqpaF'><ins id='wqpaF'></ins><ul id='wqpaF'></ul><sub id='wqpaF'></sub></form><legend id='wqpaF'></legend><bdo id='wqpaF'><pre id='wqpaF'><center id='wqpaF'></center></pre></bdo></b><th id='wqpaF'></th></span></q></dt></tr></i><div id='wqpaF'><tfoot id='wqpaF'></tfoot><dl id='wqpaF'><fieldset id='wqpaF'></fieldset></dl></div>

      <tfoot id='wqpaF'></tfoot>

      1. <small id='wqpaF'></small><noframes id='wqpaF'>

        ASP.NET 母版页:如何在 aspx 内的 head 部分插入标记

        时间:2023-08-26
              <bdo id='O0cmR'></bdo><ul id='O0cmR'></ul>

            • <i id='O0cmR'><tr id='O0cmR'><dt id='O0cmR'><q id='O0cmR'><span id='O0cmR'><b id='O0cmR'><form id='O0cmR'><ins id='O0cmR'></ins><ul id='O0cmR'></ul><sub id='O0cmR'></sub></form><legend id='O0cmR'></legend><bdo id='O0cmR'><pre id='O0cmR'><center id='O0cmR'></center></pre></bdo></b><th id='O0cmR'></th></span></q></dt></tr></i><div id='O0cmR'><tfoot id='O0cmR'></tfoot><dl id='O0cmR'><fieldset id='O0cmR'></fieldset></dl></div>
              <tfoot id='O0cmR'></tfoot>

                <small id='O0cmR'></small><noframes id='O0cmR'>

                  <legend id='O0cmR'><style id='O0cmR'><dir id='O0cmR'><q id='O0cmR'></q></dir></style></legend>
                    <tbody id='O0cmR'></tbody>

                  本文介绍了ASP.NET 母版页:如何在 aspx 内的 head 部分插入标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我知道我可以 以编程方式访问使用母版页的页面的头部这种方式(在后面的代码中):

                  I know I can access the head section of a page which uses a masterpage programmatically this way (in code behind):

                  只是一个例子(我想插入脚本和样式等):

                  This is only an example (I'd like to insert scripts and styles etc.):

                  this.Header.Title = "I just set the page's title";
                  

                  有没有一种简单的方法可以在 aspx 文件本身上以声明性方式执行此操作?

                  Is there a simple way to do this in a declarative way on in the aspx file itself?

                  有时插入客户端脚本样式声明或指向外部资源的链接会很方便.

                  Sometimes it would be handy to insert a client script or a style declaration or a link to an external resource.

                  推荐答案

                  您可以通过在 head 中使用内容区域来做到这一点,与在 body 中使用的方式完全相同 页面.例如,在您的母版页中:

                  You can do this by using content regions in the head, in exactly the same way as you would in the body of the page. eg, In your masterpage:

                  <head>
                      <link type="text/css" rel="stylesheet" href="/styles/common1.css" />
                      <script type="text/javascript" src="/scripts/common1.js"></script>
                      <asp:contentplaceholder id="ExtraStylesAndScripts" runat="server" />
                  </head>
                  

                  然后在页面本身就像这样:

                  And then in the page itself just something like:

                  <asp:content contentplaceholderid="ExtraStylesAndScripts" runat="server">    
                      <link type="text/css" rel="stylesheet" href="/styles/extra1.css" />
                      <link type="text/css" rel="stylesheet" href="/styles/extra2.css" />
                      <script type="text/javascript" src="/scripts/extra1.js"></script>
                      <script type="text/javascript" src="/scripts/extra2.js"></script>
                  </asp:content>
                  

                  这篇关于ASP.NET 母版页:如何在 aspx 内的 head 部分插入标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何防止 WebClient 类自动跟随标头中的位置? 下一篇:获取没有 Content-Disposition 的文件名

                  相关文章

                  最新文章

                  <small id='zstLv'></small><noframes id='zstLv'>

                    <legend id='zstLv'><style id='zstLv'><dir id='zstLv'><q id='zstLv'></q></dir></style></legend>

                      <i id='zstLv'><tr id='zstLv'><dt id='zstLv'><q id='zstLv'><span id='zstLv'><b id='zstLv'><form id='zstLv'><ins id='zstLv'></ins><ul id='zstLv'></ul><sub id='zstLv'></sub></form><legend id='zstLv'></legend><bdo id='zstLv'><pre id='zstLv'><center id='zstLv'></center></pre></bdo></b><th id='zstLv'></th></span></q></dt></tr></i><div id='zstLv'><tfoot id='zstLv'></tfoot><dl id='zstLv'><fieldset id='zstLv'></fieldset></dl></div>
                    1. <tfoot id='zstLv'></tfoot>

                        <bdo id='zstLv'></bdo><ul id='zstLv'></ul>