I have a formview:
I don't store images or image urls in the DB, I just use the part_code which is part of the image name, to pull the image from a "/Parts/" directory. What I want to do is display a default image, say "NotAvail.gif" if there is no image in the directory for a given part_code.
I can't seem to figure out how to do this. I don't know how to check the directory or do the replace. Can anyone help me with the code behind for this?
Thanks!
Code:
<asp:FormView CellPadding="4" ID="fvImg" runat="server" OnDataBinding="fvImg_OnDataBinding" EmptyDataText="There are no items associated with your selected criteria." DataSourceID="PartDetailDataSource">
<ItemTemplate>
<tr>
<td style="width:255px;" rowspan="7" valign="top">
<asp:Image ID="partImg" runat="Server" ImageUrl='<%# "/Parts/" + Eval("PART_CODE") + "-0-250x188.jpg" %>' />...
I don't store images or image urls in the DB, I just use the part_code which is part of the image name, to pull the image from a "/Parts/" directory. What I want to do is display a default image, say "NotAvail.gif" if there is no image in the directory for a given part_code.
I can't seem to figure out how to do this. I don't know how to check the directory or do the replace. Can anyone help me with the code behind for this?
Thanks!