数据库中用一个字段来代表其应该使用的图标类型。DataGrid 中用一个Label控件来包含显示图片的 html <asp:label id=imagelabel runat=server><img src='<%# GetImageName(container.dataitem("imagetype") %>'></asp:label>code behind中定义一个函数: Public Function GetImageName(ByVal img As Object) As String
If img Is DBNull.Value Then
Return "file.gif"
Else
If img.ToString() = "dir" then
Return "dir.gif"
else
Return "file.gif"
end if
End If
End Function
If img Is DBNull.Value Then
Return "file.gif"
Else
If img.ToString() = "dir" then
Return "dir.gif"
else
Return "file.gif"
end if
End If
End Function
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货