应该是调用用户自定义控件的问题,和类的继承关系上的问题。
APP.Code 文件下有FeedBaseControl.cs
namespace Real.UserCenter.Web.Controls.Feeds
{
public class FeedBaseControl : System.Web.UI.UserControl
{
打算写的代码*****
}
}
在同一根目录下还有Controls,Controls下的feeds文件夹里有个用户自定义控件AttectionFeed.ascx。他的cs代码如下:
namespace Real.UserCenter.Web.Controls.Feeds
{
public partial class AttectionFeed : FeedBaseControl
{
protected void Page_Load(object sender, EventArgs e)
{
打算写的代码******
}
}
}
现在Controls文件夹下有AllFeedsList.ascx,前台有ASP的repeater控件
它的.CS后台文件:
using Real.UserCenter.Web.Controls.Feeds
namespace Real.UserCenter.Web.Controls
{ public partial class AllFeedsList : System.Web.UI.UserControl
{
****
protected void rpList_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
AttectionFeed attectionFeed = LoadControl("~/Controls/Feeds/AttectionFeed.ascx") as AttectionFeed;
}
}
}
提示:错误,未能找到类型或命名空间名称“AttectionFeed”(是否缺少 using 指令或程序集引用?)
求大神指点。已经把using 加上去了,为啥还报错了
APP.Code 文件下有FeedBaseControl.cs
namespace Real.UserCenter.Web.Controls.Feeds
{
public class FeedBaseControl : System.Web.UI.UserControl
{
打算写的代码*****
}
}
在同一根目录下还有Controls,Controls下的feeds文件夹里有个用户自定义控件AttectionFeed.ascx。他的cs代码如下:
namespace Real.UserCenter.Web.Controls.Feeds
{
public partial class AttectionFeed : FeedBaseControl
{
protected void Page_Load(object sender, EventArgs e)
{
打算写的代码******
}
}
}
现在Controls文件夹下有AllFeedsList.ascx,前台有ASP的repeater控件
它的.CS后台文件:
using Real.UserCenter.Web.Controls.Feeds
namespace Real.UserCenter.Web.Controls
{ public partial class AllFeedsList : System.Web.UI.UserControl
{
****
protected void rpList_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
AttectionFeed attectionFeed = LoadControl("~/Controls/Feeds/AttectionFeed.ascx") as AttectionFeed;
}
}
}
提示:错误,未能找到类型或命名空间名称“AttectionFeed”(是否缺少 using 指令或程序集引用?)
求大神指点。已经把using 加上去了,为啥还报错了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货