View Single Post
  #1 (permalink)  
Old March 2nd, 2012, 09:47 AM
Abhishek Kumar Abhishek Kumar is offline
Authorized User
Points: 265, Level: 5
Points: 265, Level: 5 Points: 265, Level: 5 Points: 265, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2010
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to display image using gridview ?

Dear Sir,
I would like to display image using Grid view.
Please help me.

The code is as follows.


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
PageSize="6" onselectedindexchanged="GridView1_SelectedIndexCha nged"
Height="1019px" Width="705px">
<Columns>
<asp:CommandField ShowSelectButton="True" ButtonType="Button"
SelectText="Purchase Book" />
<asp:TemplateField>
<HeaderTemplate>Book</HeaderTemplate>

<ItemTemplate>
<asp:Image ID= "Imagebooks" runat="server" ImageUrl='<%# Eval("BookImage")%>' Height="150" Width="120" />
</ItemTemplate>



</asp:TemplateField>
<asp:BoundField DataField="BookName" HeaderText="BookName"
SortExpression="BookName" />
<asp:BoundField DataField="Price" HeaderText="Price in Dollar($)" SortExpression="Price" />
<asp:BoundField DataField="Quantity" HeaderText="Quantity Available" SortExpression="Quantity" />
</Columns>
</asp:GridView>