Posted on: 3/20/2014 10:41:23 AM | Views : 590

Hi Guys,
Hope you can help me on this one :)
I have a gridview, and within this i have an image field where the visibility is dependant upon a comparison between two fields from the database. This works great, except when there is a null within the database itself, and as a result the page returns an error.

Here's my code:
<asp:TemplateField> <ItemTemplate> <asp:Image ImageUrl="~/Images/warning.jpg" runat="server" width="40px" Height="40px" ToolTip="The compliance score for this metric is below the green threshold, please ensure an action plan is provided" Visible='<%# ((Convert.ToDouble(Eval("[compliance score]"))) < (Convert.ToDouble(Eval("[g]")))) && (Convert.ToString(Eval("[APInPlace]"))) == "False" ...

Go to the complete details ...