如何写自定义控件和如何引用它?
我想在自定义用户控件中继承DataGrid,方法如下:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace Grid
{
/// <summary>
/// WebCustomControl1 的摘要说明。
/// </summary>
public class PowerGrid : DataGrid,INamingContainer
{
private BoundColumn boundCol;
private ButtonColumn delCol;
private EditCommandColumn editCol;
[Bindable(true),
Category("Appearance"),
DefaultValue("")]
/// <summary>
/// 将此控件呈现给指定的输出参数。
/// </summary>
/// <param name="output"> 要写出到的 HTML 编写器 </param>
protected override void Render(HtmlTextWriter output)
{
base.Render(output);
}
请各位指出错误,还有,我怎么在别的项目中使用它?
<%@ Register TagPrefix="Grid" Namespace="Grid" Assembly="Grid.Control.PowerGrid" %>,
<Grid:PowerGrid id="mygrid" runat="server"/>可总是提示创建控件错误