首页 > 代码库 > Repeater 嵌套

Repeater 嵌套

protected void rptDataList_ItemDataBound(object sender, RepeaterItemEventArgs e)

{

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) //这个条件是必须的,否则会出现间接没有绑定到数据的情况

{

EJob mm = (EJob)e.Item.DataItem;

HyperLink lnkAA = (HyperLink)e.Item.FindControl("lnkAppJob");

lnkAA.NavigateUrl = "JobInfo.aspx?jid=" + mm.ID.ToString();

if (UserData.Job_ID == mm.ID)

{

lnkAA.Text = "已申请";

lnkAA.ForeColor = System.Drawing.Color.Red;

}

else

{

lnkAA.Text = "<img src=http://www.mamicode.com/"images/35.gif\" width=\"83\" height=\"28\" border=\"0\" />";

}

}

}

Repeater 嵌套