我的代码:
For i = 0 To rpt.Controls.Count - 1
myCheckBox = rpt.Items(i).FindControl( "cb_Id ")
Next i
总是提示:System.ArgumentOutOfRangeException: 索引超出范围。必须为非负值并小于集合大小
可我用Label5.Text = rpt.Controls.Count - 1 时显示的是5 说明是有数据的...不知道为什么啊..各位大虾帮帮忙哟.小弟先谢了.
------解决方案--------------------------------------------------------
xuexi
------解决方案--------------------------------------------------------
rpt.Controls.Count跟rpt.Items.count是不一样的吧
------解决方案--------------------------------------------------------
protected void commentRpt_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
DataRowView item = (DataRowView)e.Item.DataItem;
int commentUserId = Convert.ToInt32(item[ "UserId "].ToString());
int level = Convert.ToInt32(item[ "Level "].ToString());
}
------解决方案--------------------------------------------------------
For i = 0 To rpt.Controls.Count - 1
myCheckBox = rpt.Items(i).FindControl( "cb_Id ")
Next i
++++++++++++++++++++++++++++++++++++++
for i = 0 to rpt.items.count -1
myCheckBox = rpt.Items(i).FindControl( "cb_Id ")
Next i
------解决方案--------------------------------------------------------
路过.顶一下.