<asp:DataList id="DataList1" runat="server" RepeatColumns="3" Width="100%" CellPadding="0" CellSpacing="0"
RepeatDirection="Horizontal">
<ItemTemplate>
<table width="152" border="0" cellpadding="1" align="center">
<tr>
<td height="121" bgcolor="#a2daff"><table width="100%" border="0" cellpadding="3" bgcolor="#ffffff">
<tr>
<td height="113" bgcolor="#ffffff" align="center">
<a href="Show.aspx?MemberID=<%# container.dataitem("MemberID")%>" target="_blank"><img src="/UploadImages/TitleImage/<%# container.dataitem("MemberID")%><%# container.dataitem("PicUrl")%>" width="150" height="110" border="0"></a>
</td>
</tr>
<tr>
<td height="20" bgcolor="#ffffff" align="center"><font color="#ff6600">会员:</font><a href="Show.aspx?MemberID=<%# container.dataitem("MemberID")%>" target="_blank"><%# container.dataitem("TrueName")%></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>就是上面这段代码了,现在需要判断,数据库里的图片字段是否为空?如果为空就默认指向一张图片??否则就指下数据库图片字段里的图片,这里怎么写?我实在不明白?各位教教啊
RepeatDirection="Horizontal">
<ItemTemplate>
<table width="152" border="0" cellpadding="1" align="center">
<tr>
<td height="121" bgcolor="#a2daff"><table width="100%" border="0" cellpadding="3" bgcolor="#ffffff">
<tr>
<td height="113" bgcolor="#ffffff" align="center">
<a href="Show.aspx?MemberID=<%# container.dataitem("MemberID")%>" target="_blank"><img src="/UploadImages/TitleImage/<%# container.dataitem("MemberID")%><%# container.dataitem("PicUrl")%>" width="150" height="110" border="0"></a>
</td>
</tr>
<tr>
<td height="20" bgcolor="#ffffff" align="center"><font color="#ff6600">会员:</font><a href="Show.aspx?MemberID=<%# container.dataitem("MemberID")%>" target="_blank"><%# container.dataitem("TrueName")%></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>就是上面这段代码了,现在需要判断,数据库里的图片字段是否为空?如果为空就默认指向一张图片??否则就指下数据库图片字段里的图片,这里怎么写?我实在不明白?各位教教啊
解决方案 »
- 关于注入的问题!不太明白,请指教啊!
- 如何通过ip来限制访问者浏览权限???
- 请教各位关于图片新闻滚动如何实现???
- 请教做水晶报表为何不显示图表
- GridView绑定数据问题!!!
- 请问大家,在asp.net2.0中,怎么为DataList添加一个自增长编号的列啊????
- 怎么样绑Repeater呀?
- 控件帮定到Dataset的DataTable中,如何进行分页处理?控件非GridView.
- 求助 --- ASP 如何获得 数据表的字段名,----各位大虾帮忙啦!!!!!在线等待
- 请教:怎么在一个虚拟目录上配置让两个WEB应用程序并存
- 关于datagrid中页码值的问题
- 谁能帮我把这段代码简化一下!!
<%# GetImgPath(DataBinder.Eval(Container, "DataItem.path").ToString()) %>
<I/temTemplate>GetImgPath定义:
protected string GetImgPath(string imgpath)
{
if(imgpath!="")
{
return imgpath;
}
else
{
retunr "image.gif";//默认图片
}
}