display an image (more info)
in the HTML code displayed on page 99 of 'Building Web Solutions with ASP.net', the example is type cast as an int because the boss column (I'm gussing) is numeric. In my case, my column is DateTime. If I type cast it as DateTime, DateTime is not recognized. String does not work either.
Here's my HTML:
<asp:TemplateColumn HeaderText="Status">
<ItemTemplate>
<asp:image runat="server" Width="79px" Height="79px" ImageUrl='<%# GetProperBmpFile(DataBinder.Eval(Container.DataIte m,"AccreditationExp")) %>'/>
</asp:Image> </ItemTemplate> </asp:TemplateColumn>
My code behind:
//expDate is DateTime type and a string is returned
fileName=GetProperBmpFile(expDate);
public string GetProperBmpFile(DateTime exp)
{
string stringDate;
stringDate = exp.ToString();
return "BeautyAndTheBeast.bmp";
}
|