Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to display images in multiple columns of gridview ?
Posted
Comments
Praveen Kumar Upadhyay 18-Dec-14 4:57am    
What do you mean by? Can you please elaborate and explain the things in brief.

Default.aspx
XML
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
        <Columns>
        <asp:TemplateField>
        <ItemTemplate>
        <td><asp:Label ID="lblLabel" runat="server" Text="<%Evl('id') %>" /></td>
        <td><asp:Image ID="img1" runat="server" ImageUrl="<%Evl('path') %>"/></td>
        </ItemTemplate>
        </asp:TemplateField>
        </Columns>
        </asp:GridView>


Default.aspx.cs
C#
GridView1.DataSource=dt;
GridView1.DataBind()
 
Share this answer
 
Comments
Member 10714689 18-Dec-14 5:24am    
my req is to display item images in columns of gridview for a online shoping portal.i need to display different product images in multiple columns of gridview.is your code suit my req?
Sid_Joshi 18-Dec-14 5:27am    
yes,
add product id in sql id filed
and image path in sql path column
asp will automatically sets ImageUrl property=your image path
Member 10714689 18-Dec-14 5:33am    
thanks a lot.
if images are stored in database then add image in grid view and fill them by converting into images on row databound event
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900