Hi,
can enybody help me please. I have a gridview with column that shows the images dynamically from database (see code below). What I need it to do is check to see if there is an image in each row to display it, and if there is not then display a standard image from directory. I think that is better solution than storing default images in each row in database where there is no image (users should be able to upload images). How can I do this?
Thanks.
<asp:datagrid id="myGrid" runat="server"
width="92%" cellpadding="5" font-size="8pt"
gridlines="hori zontal"
headerstyle-backcolor="slat egray"
headerstyle-forecolor="ivor y"
headerstyle-font-bold="true"
ItemStyle-VerticalAlign=" Top"
AutoGenerateCol umns="false"
CellSpacing="5" >
<columns>
<asp:templateco lumn>
<itemtemplate >
<a href='Home.aspx ' >
<img alt="Click for details"
src="Handler.as hx?Image_Id=<%# Eval("Image_Id" ) %>" />
</a>
</itemtemplate>
</asp:templatecol umn>
<asp:boundcolum n headertext="Ima ge_Id"
datafield="Imag e_Id" />
<asp:boundcolum n headertext="Ima ge_Type"
datafield="Imag e_Type" />
</columns>
<ItemStyle VerticalAlign=" Top" />
<HeaderStyle BackColor="Slat eGray" Font-Bold="True" ForeColor="Ivor y" />
</asp:datagrid>
can enybody help me please. I have a gridview with column that shows the images dynamically from database (see code below). What I need it to do is check to see if there is an image in each row to display it, and if there is not then display a standard image from directory. I think that is better solution than storing default images in each row in database where there is no image (users should be able to upload images). How can I do this?
Thanks.
<asp:datagrid id="myGrid" runat="server"
width="92%" cellpadding="5" font-size="8pt"
gridlines="hori zontal"
headerstyle-backcolor="slat egray"
headerstyle-forecolor="ivor y"
headerstyle-font-bold="true"
ItemStyle-VerticalAlign=" Top"
AutoGenerateCol umns="false"
CellSpacing="5" >
<columns>
<asp:templateco lumn>
<itemtemplate >
<a href='Home.aspx ' >
<img alt="Click for details"
src="Handler.as hx?Image_Id=<%# Eval("Image_Id" ) %>" />
</a>
</itemtemplate>
</asp:templatecol umn>
<asp:boundcolum n headertext="Ima ge_Id"
datafield="Imag e_Id" />
<asp:boundcolum n headertext="Ima ge_Type"
datafield="Imag e_Type" />
</columns>
<ItemStyle VerticalAlign=" Top" />
<HeaderStyle BackColor="Slat eGray" Font-Bold="True" ForeColor="Ivor y" />
</asp:datagrid>
Comment