我需要默认图像设置为asp.net图像控制,因为我用的DataList设置图像的URL设置默认图片发送给ASP图像控制
<asp:Image ID="Image1" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "ImgPath")%>'
AlternateText="No Pic" Width="107" Height="86" />
有时DataBinder的不imgpath返回,所以我需要设置默认图像的影像控制 TP表现出来时imgpath is null
@Muhammad阿赫塔尔的回答是更优雅。好的想法;) –
我该怎么做? – Mounir
使用Muhammad Akhtar的答案,这是一个更好的方式。 –