如何使用linq从asp.net中的数据库中检索GridView中的图像 [英] How to retrieve image in GridView from database in asp.net using linq

查看:67
本文介绍了如何使用linq从asp.net中的数据库中检索GridView中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

当我实施一个程序时,我有一些问题。我很容易在数据库中插入图像但现在这次显示图像我无法理解如何从gridview中检索图像数据库。



所以请尽快给我信息。



先谢谢!!

Dear Friend,
When i am implementing a program i have some problem.I am inserted image in database very easily but now this time to show image i cant understand how to retrieve image in gridview from database.

So please give me information as soon as possible.

Thanks in advanced !!

推荐答案

首先你应该在行命令中找到控件...



first you should find control in row command...

protected void gvUserInfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
      {
             Image img= (Image)e.Row.FindControl("image1");

                var Data=from p in p.TableName
                select p;

                img.ImageUrl=Data.first().ImageColumnName;

      }
}


这篇关于如何使用linq从asp.net中的数据库中检索GridView中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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