あなたのWebパーツは、Visual Webパーツではない場合、あなたは(WebパーツCSファイルで)このようにユーザーコントロールを読み込むことができます。
namespace ProjectName.Folder.Custom_Webpart
{
[ToolboxItemAttribute(false)]
public class Custom_Webpart : System.Web.UI.WebControls.WebParts.WebPart
{
private const string _ascxPath = @"~/_CONTROLTEMPLATES/15/ProjectName/Folder/Custom_UserControl.ascx";
protected override void CreateChildControls()
{
var control = Page.LoadControl(_ascxPath) as Custom_UserControl;
//this.ChromeType = PartChromeType.None;
Controls.Add(control);
}
}
}
あなたのWebパーツは、Visual Webパーツの場合は、ユーザーコントロールを読み込むことができますwebpart .ascxファイルに次の手順を挿入してください。
<%@ Register Src="/_controltemplates/15/ProjectName/Folder/Custom_UserControl.ascx" TagPrefix="Custom" TagName="CustomControl" %>
<Custom:CustomControl runat="server" />
お返事ありがとうございます。私はそれを試みます。 – nunonaos
特定の場所にユーザーコントロールプロジェクトを展開する必要はありますか? – nunonaos
カスタムユーザーコントロールは、SharePointのマップされたフォルダー(CONTROLTEMPLATES)に展開する必要があります。こちらをご覧ください:https://blogs.msdn.microsoft.com/vssharepointtoolsblog/2010/03/12/deploying-files-using-mapped-folders/ – Cecilia