如何使用asp.net在网格视图中显示图像 [英] How to Show image in grid view using asp.net

查看:126
本文介绍了如何使用asp.net在网格视图中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我..我正在尝试在网格视图中显示图片,但是我的代码无法正常工作....

Plz help me .. i am trying to show the pic in grid view but my code is not working....

推荐答案

在这里,看看:
MSDN:在GridView列中显示图像 [在GridView中显示数据库中的图像 [ ^ ]
在GridView中从数据库Asp.Net显示图像 [ ^ ]

试试吧!
Here, have a look:
MSDN: Displaying Images in a GridView Column[^]
Displaying Images from a Database in a GridView[^]
Display Images In GridView From DataBase Asp.Net[^]

Try!


嗨asim
即时通讯假设您已将其保存在数据库中
hi asim
im assuming that you have it in your database
<asp:GridView ID="GridView1" runat="server">
          <Columns>
              <asp:TemplateField>
                  <ItemTemplate>
                      <asp:Image ID="Image1" ImageUrl="bind the column name from database here" runat="server" />
                  </ItemTemplate>
              </asp:TemplateField>
          </Columns>
      </asp:GridView>



对于其他列,您可以重复此模板字段.
希望对您有帮助
谢谢



for other columns you can repeat this template field.
hope it will help
thanks


,而不是在ItemTemplae中使用asp:image,请在下面的代码中使用
< asp:imagefield dataimageurlfield ="ImageURLfromdatarow"/>
instead of using asp:image in ItemTemplae use below code
<asp:imagefield dataimageurlfield="ImageURLfromdatarow"/>


这篇关于如何使用asp.net在网格视图中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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