protected void rptLastPromotion_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
HtmlAnchor aView = (HtmlAnchor)e.Item.FindControl("aDescription");
Label lbldescriptionlink = (Label)e.Item.FindControl("lblDescription");
Label lbldescriptionNoLink = (Label)e.Item.FindControl("lblDescription2");
HiddenField hfIsNewTab = (HiddenField)e.Item.FindControl("hfNewTab");
for (int i = 0; i <= rptLastPromotion.Items.Count; i++)
{
if (!String.IsNullOrEmpty(aView.HRef))
{
lbldescriptionlink.Visible = true;
lbldescriptionNoLink.Visible = false;
if (Convert.ToBoolean(hfIsNewTab.Value) == true)
{
aView.Target = "_blank";
}
}
else
{
lbldescriptionlink.Visible = false;
lbldescriptionNoLink.Visible = true;
}
}
}
我想處理和查看中繼器中的項目,但在我的代碼中有錯誤。在這方面的任何幫助?ItemDataBound與中繼器如何處理
此答案有幫助嗎?你對此有任何疑問嗎? – 2013-03-28 16:45:28