在网格视图中显示图像 [英] in grid view show image

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

问题描述

在图像控件中,我与徽标列绑定,但无法绑定,并且gridview中没有图像

 <   > ; 

         <   asp:TemplateField  > 

             <   ItemTemplate  > 
             <   > 
              <   tr  > 
                 <   td     ="   4" <   big  >  <   asp:Image     ="  图片1"   运行  ="       ImageUrl   =' &%; #Eval(" )%> ' </big  >  <  /big  > 
                         宽度="75px"/> <  /td  > 
                 <   td  > 
                     <   asp:Label     ID   ="   runat   服务器" 文本  <%#Bind(" )>  <  /asp:Label  >  <  /td  > 
                 <   td     ="   4" <   asp:Label     ID   ="   runat   服务器" 文本  <%#Bind(" )%> ' >  <  /asp:Label  >  <  /td  > 
             <  /tr  > 
             <   tr  > 
                 <   td  > 联系方式:-
                      <   asp:Label     ID   ="   runat   服务器" 文本  <%#Bind(" )>  <  /asp:Label  >  <  /td  > 
             <  /tr  > 
             <   tr  > 
                 <   td  > 类别:-
                      <   asp:Label     ID   ="   runat   服务器" 文本  <%#Bind(" )%> ' >  <  /asp:Label  >  <  /td  > 
             <  /tr  > 
             <   tr  > 
                 <   td  > 城市:-
                      <   asp:Label     ID   ="   runat   服务器" 文本  <%#Bind(" )%> ' >  <  /asp:Label  >  <  /td  > 
             <  /tr  > 

                <  /table  > 
             <  /ItemTemplate  > 
         <  /asp:TemplateField  > 

     <  /Columns  >   

解决方案

原则上应该可以.检查图像<%# Eval("Logo") %>是否确实存在,并使用浏览器查看页面的源html,以查看是否正确设置了要分配给ImageUrl的值.


in the image control i m bind with logo column but it can''t bind and there is no image in gridview

<Columns>

         <asp:TemplateField>

             <ItemTemplate>
             <table>
              <tr>
                 <td rowspan="4">
                     <big><asp:Image ID="Image1" runat="server"  ImageUrl ='<%# Eval("Logo") %>'</big></big>
                         Width="75px" /> </td>
                 <td>
                     <asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label></td>
                 <td rowspan="4">Address:-
                     <asp:Label ID="Label2" runat="server" Text='<%# Bind("Address") %>'></asp:Label></td>
             </tr>
             <tr>
                 <td>Contact:-
                      <asp:Label ID="Label3" runat="server" Text='<%# Bind("Contact") %>'></asp:Label></td>
             </tr>
             <tr>
                 <td>Class:-
                      <asp:Label ID="Label4" runat="server" Text='<%# Bind("ClassName") %>'></asp:Label></td>
             </tr>
             <tr>
                 <td>City:-
                      <asp:Label ID="Label5" runat="server" Text='<%# Bind("City") %>'></asp:Label></td>
             </tr>

                </table>
             </ItemTemplate>
         </asp:TemplateField>

     </Columns>

解决方案

In principle this should work. Check that an image actually exists at <%# Eval("Logo") %> and use a browser to look at the source html for the page to see that the value you are assigning to ImageUrl is being set correctly.


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

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