关于自定义控件的问题请高手帮忙
我用VS2005的.
我先创建了WEB控件库,然后在类中继承了GRIDView控件想扩展一下他的功能.
编译以后,把该DLL文件放到工具箱引用的时候却发现这个自定义控件有关GRIDView的很多属性都点不出来,比如DataSource属性.无法绑定数据,难道这些属性无法继承??那该则么办?请高手指点.
主要代码部分:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebControlLibrary1
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 : GridView
{
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
public string Text
{
get
{
String s = (String)ViewState["Text"];
return ((s == null) ? String.Empty : s);
}
set
{
ViewState["Text"] = value;
}
}
protected override void RenderContents(HtmlTextWriter output)
{
output.Write(Text);
}
}
}
以上代码我几乎没添加过代码,都是默认的.只是加了个GRIDView继承.
但是很多原有的功能却没法继承过来.但是我看别人是可以的,请指教.