如何在满足数据库字段条件时更改gridview中的图像? [英] how to change image in gridview when database fields condition is satisfied?
本文介绍了如何在满足数据库字段条件时更改gridview中的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在gridview中更改图像。
当满足数据库中的条件时,该列为true,否则为false。
和m获取图像的真假...
那么我怎样才能在asp.net中使用sql ???
解决方案
http://www.aspdotnet- suresh.com/2011/01/how-to-insert-images-into-database-and.html [ ^ ]
It并不是你想要的,但你的问题当然可以有你自己的逻辑......并且从给定的链接中得到参考!!
Goog Luck!
您可以在gridview的itemtemplate中包含图像控件。然后在imageUrl属性中,您可以调用如下函数:
< asp:image id = myImage runat = server imageurl = < % #SetImageUrl( DataBaseCondition)%> / >
现在在你的代码后面实现SetImageUrl(string _databaseCondition)函数来se图像的网址。
您好,
您必须在DataBase结束处理它。
选择 t.Id,t.Name, CASE WHEN 标志=真然后 ' 〜/ Images / true.png' ELSE ' 〜/ Images / false.png' END 来自 表 t
I want to change the image in gridview .
When the conditions in database are satisfied, then the column is true, otherwise false.
and m fetching image for true and false...
then how can i do this in asp.net using sql???
解决方案
http://www.aspdotnet-suresh.com/2011/01/how-to-insert-images-into-database-and.html[^]
It''s not that you''re looking for, but you can certainly have your own logic for your question.. And have a reference from given link !!
Goog Luck !
You can include an image control in itemtemplate of gridview. Then in the imageUrl property you can call a function like:
<asp:image id="myImage" runat="server" imageurl="<%#SetImageUrl("DataBaseCondition")%>" />
Now in your code behind implement SetImageUrl(string _databaseCondition) function to set the url of the image.
Hi,
you must handle it at DataBase end.
Select t.Id, t.Name, CASE WHEN Flag = true THEN '~/Images/true.png' ELSE '~/Images/false.png' END from Table t
[Edit: Removed begging for votes]
这篇关于如何在满足数据库字段条件时更改gridview中的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文