不是在itemDataBound事件中。 ============================= 经过试验,应该用rpResult.Controls,而不是rpResult.Items。
(Label)rpResult.Controls[0].FindControl("xxx") 就是了。
那么foot里的用 (Label)rpResult.Controls[rpResult.Controls.Count-1].FindControl("xxx") 应该也行吧。
下面是说明:
rpResult.Items里包含的是结果行,也就是 item.GetType=AlternatingItem 或Item
rpResult.Controls里包含的repeater里的所有控件。 如: 一个repeater的header里(表头里)有6个Label, 每行有11个Label, 下面是绑定第一行数据后用以下代码输出的: ============================================================ for(int i=0;i<rpResult.Controls.Count;i++){ Response.Write(rpResult.Controls[i].GetType()+"<br>"); for(int j=0;j<rpResult.Controls[i].Controls.Count;j++){ Response.Write(rpResult.Controls[i].Controls[j].GetType()+"<br>"); } Response.Write("<hr>"); } foreach(RepeaterItem item1 in rpResult.Controls) { Response.Write(item1.ItemType +"<br>"); } ========================================================
System.Web.UI.WebControls.RepeaterItem System.Web.UI.ResourceBasedLiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl
-------------------------------------------------------------------------------- System.Web.UI.WebControls.RepeaterItem System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl System.Web.UI.WebControls.Label System.Web.UI.LiteralControl
--------------------------------------------------------------------------------
Header Item
|