【发布时间】:2011-07-21 09:00:12
【问题描述】:
我正在使用 Visual Studio 2010 为 Sharepoint 2010 开发 Web 部件。
我创建了一个想要包含在我的 Web 部件中的用户控件。但是,当我将用户控件放在 MyWebPart.ascx 中(在设计视图中)时,它会在 MyWebPart.ascx.designer.cs 中生成如下:
protected global::System.Web.UI.UserControl customUserControl;
代替:
protected global::FullNamespace.ControlTemplates.MyUserControl customUserControl;
它可以工作,但我需要在后面的代码中将customUserControl 转换为具体的 MyUserControl(例如,如果想在 PageLoad 事件中设置它的一些属性)。
我该如何解决这个问题?
【问题讨论】:
标签: asp.net visual-studio-2010 user-controls sharepoint-2010 web-parts