Posted on: 3/30/2015 1:30:15 AM | Views : 507

Hello Guys,
I am stuck with this conversion. I have image need to display inside the gridview based on the value I get from the datasource and some of the row has null datetime and having problem with conversion. here is code. Any help would be appreciated.
<asp:TemplateField> <ItemTemplate> <asp:Image ID="Image2" runat="server" ImageUrl="~/images/correct1.jpg" Visible='<%#displayIcon(Eval("File_status"), Eval("Last_Uploaded"))%>' Height="17px" Width="17px" /> </ItemTemplate> </asp:TemplateField> code behind.. protected bool displayIcon(object status, object Date) { // I get the error here while my Date value is null //Specified cast is not valid. DateTime? uploadedDate = (DateTime) Date; ...

Go to the complete details ...