<asp:imagefield dataimageurlfield="LastName"
dataimageurlformatstring="~\Images\{0}.jpg"
alternatetext="Employee Photo"
nulldisplaytext="No image on file."
headertext="Photo"
readonly="true"/>
<asp:boundfield datafield="FirstName"
headertext="First Name"/>
<asp:boundfield datafield="LastName"
headertext="Last Name"/>
if i set the datasource of the gridview to a sqldatasource with the
folowing commands
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:MyConnectionString
%>"
SelectCommand="SELECT [No_], [Picture], [Picture No_] AS Picture_No_
FROM [My Company$Item] ORDER BY [No_]
the 'Picture' is the image field, the Picture_No is used to identify
the picture, the No_ is the name of our product
and i have the following setting on my image field
<asp:ImageField DataAlternateTextField="Picture_No_"
DataImageUrlField="Picture_No_"
HeaderText="Picture" DataImageUrlFormatString="~\Image\{0}.gif">
</asp:ImageField>
i saw some example uses accessDataSource
but i think the image field should also work with sqldatasource
but when i render the gridview, the images are the Picture_No with red
cross
i am using the Visual Web Developer 2005 Express Edition in C#.Net
can someone point out what's wrong with my property settings?
especially regards to SQL Database Server
that is what stored in the database is the URL of the image instead of
the image itself
But I have no idea how an image is stored in a SQL server
I'd recommend that you store the image URL and not the image data
because you'll have less DB overhead, less mucking about with casting
to the image type, and life will generally be more pleasant.
the DataList control in VWD has the itemBound event, but C#.net have no
CType function
So is there a way I can do with GridView control, or DataList control
or some hints to declare and display a DataGrid object in codes?