0
我需要扩展Repeater控件,当没有数据要显示时不会显示。 所以我添加了类库项目到我的解决方案,并将该类添加到该类库项目。扩展控件和使用问题
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using System.Web.UI;
namespace FRMControls
{
public class CustomRepeater:Repeater
{
public ITemplate EmptyDataTemplate { get; set; }
protected override void OnDataBinding(EventArgs e)
{
base.OnDataBinding(e);
if (this.Items.Count == 0)
{
EmptyDataTemplate.InstantiateIn(this);
}
}
}
}
写完后,我添加了引用来使用这个库。 我将控件添加到aspx页面一样,
<%@ Register TagPrefix="asp" Namespace="FRMControls" Assembly="FRMControls" %>
,但我不能看到和使用的控制 我做错了什么?
你如何约束控制?它应该在哪里看到,你没有看到什么? – Oded 2011-02-02 10:16:30