有谁知道怎样在类里引用WEB自定义控件啊?
而且我做这个网站的时候总感觉很多地方应该是一个程序集的地方,引用的时个总引用不起
哪位大哥哥告诉我是怎么一回事啊?怎么解决这个问题呢?
作用是做为一个网站的母版,也就是在以后的网页中,设为他的继承就可以了
源码如下:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using FriendsReunion.Controls;//就是这里不行,他说没这个命名空间
/// <summary>
/// FriendsBase 的摘要说明
/// </summary>
namespace FriendsReunion
{
public class FriendsBase : System.Web.UI.Page
{
protected string HeaderMessage = String.Empty;
protected string HeaderIconImageUrl = String.Empty;
protected override void Render(HtmlTextWriter writer)
{
Control form = Page.Controls[1];
FriendsHeader header;
header = (FriendsHeader)LoadControl(Request.ApplicationPath + Path.AltDirectorySeparatorChar +
"Controls/FriendsHeader.ascx");
header.Message = HeaderMessage;
header.IconImageUrl = HeaderIconImageUrl;
form.Controls.AddAt(0,header);
form.Controls.AddAt(1,new SubHeader());
FriendsFooter footer;
footer = (FriendsFooter)LoadControl(Request.ApplicationPath + Path.AltDirectorySeparatorChar +
"Controls/FriendsFooter.ascx");
form.Controls.AddAt(Page.Controls[1].Controls.Count,footer);
base.Render(writer);
}
public FriendsBase()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
}
}
而且我做这个网站的时候总感觉很多地方应该是一个程序集的地方,引用的时个总引用不起
哪位大哥哥告诉我是怎么一回事啊?怎么解决这个问题呢?
作用是做为一个网站的母版,也就是在以后的网页中,设为他的继承就可以了
源码如下:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using FriendsReunion.Controls;//就是这里不行,他说没这个命名空间
/// <summary>
/// FriendsBase 的摘要说明
/// </summary>
namespace FriendsReunion
{
public class FriendsBase : System.Web.UI.Page
{
protected string HeaderMessage = String.Empty;
protected string HeaderIconImageUrl = String.Empty;
protected override void Render(HtmlTextWriter writer)
{
Control form = Page.Controls[1];
FriendsHeader header;
header = (FriendsHeader)LoadControl(Request.ApplicationPath + Path.AltDirectorySeparatorChar +
"Controls/FriendsHeader.ascx");
header.Message = HeaderMessage;
header.IconImageUrl = HeaderIconImageUrl;
form.Controls.AddAt(0,header);
form.Controls.AddAt(1,new SubHeader());
FriendsFooter footer;
footer = (FriendsFooter)LoadControl(Request.ApplicationPath + Path.AltDirectorySeparatorChar +
"Controls/FriendsFooter.ascx");
form.Controls.AddAt(Page.Controls[1].Controls.Count,footer);
base.Render(writer);
}
public FriendsBase()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货