我使用此代码更改datalist
中的标签值,但是当我运行项目时,所有这些都是正确的,但最后一个数据是空的。
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e) {
javidDataContextdc=new javidDataContext();
foreach (DataListItem li in DataList1.Items)
{
string itemID = DataList1.DataKeys[0].ToString();
Label lbl1 = (Label)li.FindControl("Label1");
Label lblt = (Label)li.FindControl("lblt");
lblt.Text = (from p in dc.tbl_writer_translators where p.wid == int.Parse(lbl1.Text) select p.fullname).First();
}
}