C# aspx实现Repeater中Header、Item、Footer的动态绑定

一、aspx页面代码


	
		

二、aspx 后台代码

protected void RPTList_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
	if (e.Item.ItemType == ListItemType.Header)
	{
		Literal ltrHeader = e.Item.FindControl("LiteralHeader") as Literal;
		ltrHeader.Text = "";
	}
	if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
	{
		Literal ltrItem = e.Item.FindControl("LiteralItem") as Literal;
		ltrItem.Text = "";
	}
	if (e.Item.ItemType == ListItemType.Footer)
	{
		Literal totalData = e.Item.FindControl("totalData") as Literal;
		totalData.Text = "";
	}
}

 

你可能感兴趣的:(C#)