是否存在图片的处理方法
方法:
public static string sptp(string ID,string root)
{
string temp = "";
if (File.Exists("E:/src/" + root + "/" + ID + ".jpg"))
{
temp = root + "/" + ID;
}
else
{
temp = "images/nopicture"; //显示预设图片
}
return temp;
}
使用:
<img src="/<%# sptp(Eval("pic").ToString(),"xsptp") %>.jpg" />

BraveHearts 最后编辑于 2008-04-22 11:24:15