在Repeater中循环遍历input的值,为什么exceptions会为空?
如果想保存在String name中改如何保存?
前台:
" />
for (int i = 0; i < rptList.Items.Count; i++)
{
HtmlInputText txt_exceptions = (HtmlInputText)rptList.Items[i].FindControl("txt_name");
}
repeater2 数据源查询的一个条件值 是repeater1的一个值,这个值是跟repeater2 在同一行的吗?
如果是的话可以使用repeater1的itemdatabound事件来绑定
protected voidrepeater1_itemdatabound(object sender, repeateritemeventargs e)
{
if (e.item.itemtype == listitemtype.item || e.item.itemtype == listitemtype.alternatingitem)
{
label lbljobcategoryid = e.item.findcontrol("lbljobcategoryid") as label;
label lblcategoryname = e.item.findcontrol("lblcategoryname") as label;
jobcategory entityjobcategory = new jobcategory();
repeater repeater2= e.item.findcontrol("repeater2") as repeater;
var source = entityjobcategory.getjobcategorycontact(lbljobcategoryid.text.toint());
repeater2.datasource = source;
repeater2.databind();
}
}
如果不是的话只能绑定完repeater1之后遍历整个repeater1
foreach (gridviewrow gdrow in repeater1.rows)
{
label lbljobcategoryid = gdrow.findcontrol("lbljobcategoryid") as label;
label lblcategoryname = gdrow.findcontrol("lblcategoryname") as label;
jobcategory entityjobcategory = new jobcategory();
repeater repeater2= gdrow.findcontrol("repeater2") as repeater;
var source = entityjobcategory.getjobcategorycontact(lbljobcategoryid.text.toint());
repeater2.datasource = source;
repeater2.databind();
}