![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
Code
for (int i = 0; i < imageNames.Length; i++)
{
string imgSrc = string.Empty;
if (imageNames[i].Trim() != "")
{
imgSrc = System.Configuration.ConfigurationManager.AppSettings["WebPath"].ToString() + "IndexImage/" + imageNames[i];
}
//用FindControl取得前台母版页中Span对象的引用
//并转化为HtmlGenericControl 类型
System.Web.UI.HtmlControls.HtmlGenericControl spImage = (System.Web.UI.HtmlControls.HtmlGenericControl)Page.Master.FindControl("CenterContent").FindControl(string.Format("spImage{0}", i + 1));
if (imgSrc.Trim() != "")
{
spImage.Style["display"] = "block";
spImage.InnerHtml = "<a href='" + imgSrc + "' target='_blank'><img src='" + imgSrc + "' alt='" + dr["ImageDesc"].ToString() + "' border='0' width=120 height=45 /></a>";
}
else
{
spImage.Style["display"] = "none";
}
}
<!--前台母版页框架-->
<asp:Content ID="Content1" ContentPlaceHolderID="CenterContent" Runat="Server">
……
</asp:Content>
posted @
2009-06-16 09:37
keep moving
阅读(
440)
评论()
编辑
收藏
举报