我正在尝试创建简单的网格视图自定义服务器控件,但它不会呈现。
命名空间GridViewServerControl1 {
[ToolboxData("<{0}:GridViewServerControl1 runat=server></{0}:GridViewServerControl1>")]
public class GridViewServerControl1 : CompositeControl
{
GridView grd;
protected override void CreateChildControls()
{
grd = new GridView();
grd.ID = "rgd";
this.Controls.Add(grd);
}
public override void RenderControl(HtmlTextWriter writer)
{
grd.RenderControl(writer);
}
}
}