ItemDataBound 事件中获取行的值
protected void RepService_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
//DataBinder.Eval(e.Item.DataItem, "数据库字段")
//int i = Convert.ToInt32(Databinder.Eval(e.Item.DataItem,"ID"));
RepeaterItem item = e.Item;
string summary = DataBinder.Eval(e.Item.DataItem, "summary").ToString();
LinkButton LinkBtnExam = e.Item.FindControl("LinkBtnExam") as LinkButton;
if (string.IsNullOrEmpty(summary))
{
LinkBtnExam.Enabled = false;
}
}
}
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
//DataBinder.Eval(e.Item.DataItem, "数据库字段")
//int i = Convert.ToInt32(Databinder.Eval(e.Item.DataItem,"ID"));
RepeaterItem item = e.Item;
string summary = DataBinder.Eval(e.Item.DataItem, "summary").ToString();
LinkButton LinkBtnExam = e.Item.FindControl("LinkBtnExam") as LinkButton;
if (string.IsNullOrEmpty(summary))
{
LinkBtnExam.Enabled = false;
}
}
}