如果在gridview中没有要从数据库中显示的图像,则显示透明图像 [英] displaying transparent image if no image to display from the database in gridview

查看:96
本文介绍了如果在gridview中没有要从数据库中显示的图像,则显示透明图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了员工母版页,其中员工图像和其他详细信息显示在列表页面中。

如果员工没有上传图像而不是替代文本我想要显示透明图像。任何人都可以帮我吗?

I have created employee master page where employee image and other details are displayed in the list page.
If employee has not uploaded the image instead of Alternate Text i want Transparent image to be displayed. Can anyone help me with this?

推荐答案

替代文字仅用于不用于图像的文字。



默认情况下,如果特定用户没有图像,则显示后面代码的默认图像。

将图像存储在某个文件夹中并将其绑定为这样



byte [] imageBytes = File.ReadAllBytes(Server.MapPath(/ images / no-pic.gif));
Alternate text is used only for text not for image.

By default show an default image from code behind, if for particular user dose not have image.
store an image in some folder and bind it like this

byte[] imageBytes = File.ReadAllBytes(Server.MapPath("/images/no-pic.gif"));


透明图像是什么意思?
What do you mean by Transparent Image?


我使用的是mozilla firefox浏览器,在aspx文件中我提到了GenerateEmptyAlternateText为true。如果没有图像显示它将是空的。

但是如果用户在其他浏览器中打开我的应用程序,该列将会出现图像损坏。

如何使其透明?
I am using mozilla firefox browser and in aspx file i have mentioned GenerateEmptyAlternateText as true. if no image is there to display it will be empty.
But if user opens my application in some other browser the column will have broken images.
How to make it transparent?


这篇关于如果在gridview中没有要从数据库中显示的图像,则显示透明图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆