Display Images In a datagrid

  • Thread starter Thread starter John Do
  • Start date Start date
J

John Do

Hi,
I want to store the path and the name of the images in a
sql 2000 database and all the images in a folder named
images. And then I want to display all the images in a
datagrid. Does any one know how to do it?
Thanks in advance
Jonh
 
Manually bind the columns to your datagrid. Set
autogeneratecolumns property to false. Then put this among
your DataGrid columns.

<ASP:TEMPLATECOLUMN HEADERTEXT="Signature">
<ITEMTEMPLATE>
<ASP:IMAGE Height="35" Width="180" ImageUrl='<%#
DataBinder.Eval(Container.DataItem, "YourImageLocation") %
 
Hi John,
It is simple. Get the dataset with say Id, Display Name
and Image Name. In the datagrid, make 2 templates, say one
for Id and the other to display image with display name as
alternate text.
In the second template use something like this
<asp:TemplateColumn >
....
<ItemTemplate>
<img src='images/<%#
DataBinder.Eval(Container.DataItem,"ImageName")%>' alt='<%#
DataBinder.Eval(Container.DataItem,"DisplayName")%>' border=0 >
</ItemTemplate>
....
</asp:TemplateColumn>
Hope that helps
Have a great day:)
R. Pooran Prasad
Itreya Technologies Pvt Ltd.,
Mail: (e-mail address removed)
Phone(Off) : 5200179/80/81/82/83 Extn: 42
Mobile: +91 98860 29578
 
Back
Top