根据数据库数据在gridview中显示图像 [英] display imge in gridview based on databse data
本文介绍了根据数据库数据在gridview中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我
解决方案
嗨 斯里尼瓦斯,
请执行以下操作:
我已将 DataKeyNames = Total 添加到gridview
< asp:GridView DataKeyNames =" ID =" gvName" runat 服务器" span> onrowdatabound =" gvName_RowDataBound1" < /asp:GridView >
受保护的 void gvName_RowDataBound(对象发件人,GridViewRowEventArgs e) { 如果(例如,Row.RowType == DataControlRowType.DataRow) { int total = Convert.ToInt32(gvName.DataKeys [ 0 ].Value); 如果(总计== 0 ) { // 我认为您的第四列是帐户状态" e.Row.Cells [ 3 ].Text = " ; } } }
谢谢,
Imdadhusen
hi
i am using gridview for displaying data , here i retrieve few rows of information from database, In this i have amount column . i have to add all the retrieved rows amount column if the total amount will be 0 , i have to show status as close in gridview. how to do above functionality
help me please
解决方案
Hi Srinivas,
Please do the following:
I have added DataKeyNames=Total to the gridview
<asp:GridView DataKeyNames="Total" ID="gvName" runat="server" onrowdatabound="gvName_RowDataBound1"> </asp:GridView>
protected void gvName_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int total = Convert.ToInt32(gvName.DataKeys[0].Value); if (total == 0) { //I assumed your 4th number of column is for Account Status e.Row.Cells[3].Text = "Closed"; } } }
Thanks,
Imdadhusen
这篇关于根据数据库数据在gridview中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文