|M| 给Repeater 嵌套添加控件事件 急
protected void rp_Main_PreRender(object sender, EventArgs e)
{
foreach (RepeaterItem item in rp_Main.Items)
{
Repeater rp_Min = (Repeater)item.FindControl( "rp_Min ");
rp_Min.ItemCommand += new RepeaterCommandEventHandler(Min_ItemCommand);
}
}
public void rp_Min_ItemCommand(object source, RepeaterCommandEventArgs e)
为什么添加不了了事件啊
------解决方案--------------------rp_Main_PreRender
换databound
------解决方案-------------------- private void Repeater1_ItemCreated(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType==ListItemType.SelectedItem)
{
Repeater _subRepeater=(Repeater)e.Item.FindControl( "repeaterSub ");
_subRepeater.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.init_r);
}
}
private void init_r(object sender,System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
..
}
------解决方案--------------------学习