zoukankan      html  css  js  c++  java
  • asp.net引用用户控件

    页面上直接引用

    <%@ Register TagPrefix="scott" TagName="header" Src="Controls/Header.ascx" %>
    <%@ Register TagPrefix="scott" TagName="footer" Src="Controls/Footer.ascx" %>
    <%@ Register TagPrefix="ControlVendor" Assembly="ControlVendor" %>

    <html>
    <body>
        
    <form id="form1" runat="server">
            
    <scott:header ID="MyHeader" runat="server" />
        </
    form>
    </body>
    </html>

    配置文件引用(全局)

    <?xml version="1.0"?>
    <configuration>
      
    <system.web>
        
    <pages>
          
    <controls>
            
    <add tagPrefix="scottgu" src="~/Controls/Header.ascx" tagName="header"/>
            <
    add tagPrefix="scottgu" src="~/Controls/Footer.ascx" tagName="footer"/>
            <
    add tagPrefix="ControlVendor" assembly="ControlVendorAssembly"/>
          </
    controls>
        
    </pages>
      
    </system.web>
    </configuration>
    当用户控件在同一个文件目录下的时候不能用配置文件引用,应该用"页面上直接引用",原因不解释

  • 相关阅读:
    [LeetCode] 240
    [LeetCode] 169
    [LeetCode] 28
    [LeetCode] 27
    [LeetCode] 14
    [LeetCode] 9
    [LeetCode] 7
    [LeetCode] 2
    数据库开发规范
    Mysql优化
  • 原文地址:https://www.cnblogs.com/henw/p/2050258.html
Copyright © 2011-2022 走看看