Re: Checkbox = null, Specified cast is not valid.
- From: Alexey Smirnov <alexey.smirnov@xxxxxxxxx>
- Date: Thu, 25 Oct 2007 21:52:43 -0000
On Oct 25, 10:58 pm, rkbnair <rkbn...@xxxxxxxxxxxxxxxx> wrote:
<edititemtemplate>
<asp:CheckBox ID="giChkBox_bln_removed" runat="server" Checked='<%#
Bind("bln_removed")%>'></asp:CheckBox>
</edititemtemplate>
The above line gives an error (Specified cast is not valid.) if the field
bln_removed is null. Without changing the SQL select statement how can we fix
this?
In C#:
<%# Bind("bln_removed")==DBNull.Value ? "" : Bind("bln_removed") %>
In VB.NET:
<%# IIf(IsDBNull(Bind("bln_removed")), "", Bind("bln_removed")) %>
.
- Prev by Date: Localization getting resource string from class.
- Next by Date: Re: Forcing ASP.NET 1.1 isn't working
- Previous by thread: Localization getting resource string from class.
- Next by thread: Re: Checkbox = null, Specified cast is not valid.
- Index(es):