I need to learn a little about how to handle the following: - I have a misc_text_2 data field that is of type varchar (25) and is nullable. Now, if I use the following syntax
<asp:Label ID="lblPrinter" runat="server" Text='<%# iif(eval("misc_text_2") is dbnull.value, "", iif(eval("misc_text_2") like "NA", "None", iif(eval("misc_text_2") like "KP1", "Kitchen Printer 1", iif(eval("misc_text_2") like "KP2", "Kitchen Printer 2", iif(eval("misc_text_2") like "KP3", "Kitchen Printer 3", iif(eval("misc_text_2") like "BP1", "Bar Printer 1", iif(eval("misc_text_2") like "BP2", "Bar Printer 2", iif(eval("misc_text_2") like "BP3", "Bar Printer 3", Eval("misc_text_2")))))))))%>'></asp:Label>
I keep getting the error. Exception Details: System.InvalidCastException: Invalid conversion from DBNull to type 'String'.
I know something is missing for me, but what ...
Thanks in advance
mEeRkAt
source share