Help On Datalist Binding

Posted by Vijayar under C# on 8/22/2011 | Points: 10 | Views : 976 | Status : [Member] | Replies : 1
Hi
i am binding images to a datalist,based on dateofbirth column.If no images for a particular user then i should display text as nophoto for the user.how to check it and where to write the code.Please help me
<asp:DataList ID="dtlbirthday" runat="server" RepeatColumns="2"
RepeatDirection="Horizontal" Width="300px" RepeatLayout="Table">
<ItemTemplate>
<div align="center" style="float: left; width: 100px; height: 125px; overflow: hidden;
padding: 1px; margin: 5px 0px 5px 0px; border-right: 1px #DAD9DA dotted;">
<table id="Table1" cellpadding="1" cellspacing="1"
visible ="true" width="370px">
<tr>
<td width="50px">

<asp:Label ID="lblEmpCode" runat ="server" Visible="false"
CssClass="LabelStyle" Text=' <%#
DataBinder.Eval(Container.DataItem,
"EmployeeId")%>'></asp:Label>

<td>
</tr>
<tr>
<td width="160px">

<asp:Image ID="Image1" Height="75px" Width="100px" ImageUrl='<%#Eval("EmployeeImage")%>' runat="server" />

</td>
</tr>
<tr>
<td width="160px">

<asp:Label ID="lblEmpName" runat ="server" ForeColor="#000000"
CssClass="LabelStyle" Text=' <%#
DataBinder.Eval(Container.DataItem,
"Name")%>'></asp:Label>

</td>
</tr>
</table>
</div>
</ItemTemplate>
</asp:DataList>
in cs
void code
{
}
Now i am getting empty space in img place

vijaya


Responses

Posted by: Jpchoudhari on: 8/22/2011 [Member] Starter | Points: 25

Up
0
Down
set the image property
 AlternateText="nophoto"


Kind Regards,
Jay

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response