1 把UserControl如:UCCommentPart.ascx,放到如下路径下
C:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/CONTROLTEMPLATES
2 在布局页面中头中
<%@ Register src="/_controltemplates/UCCommentPart.ascx" tagname="UCCommentPart" tagprefix="uc2" %>
相应位置添加UserControl即可。
<div>
<uc2:UCCommentPart ID="UCCommentPart1" runat="server" />
</div>
3 注意,不能放在wpresources目录下。如:
C:/Inetpub/wwwroot/wss/VirtualDirectories/10001/wpresources
在布局页面“文章页面中”添加,自定义UserControl
最新推荐文章于 2025-06-22 14:30:44 发布
本文介绍如何将自定义的ASP.NET用户控件(UserControl)部署到指定文件夹,并在网页布局中引用该控件。具体步骤包括放置UserControl文件、注册控件以及在页面中使用。
2万+

被折叠的 条评论
为什么被折叠?



