when there is null value in column we get following error
Object cannot be cast from DBNull to other types.
adding following dbnull.value?false will resolve error in you f=gridview
Checked='<%#Eval("Approved")==DBNull.Value?false: Convert.ToBoolean(Eval("Approved")) %>'
<ItemTemplate>
<asp:CheckBox ID="chkStatus"
runat="server" Checked='<%# Eval("Approved") == DBNull.Value ? false
: Convert.ToBoolean(Eval("Approved")) %>'
Text='<%#
Eval("Approved").ToString().Equals("0") ? " Approved
" : " Pending " %>' />
</ItemTemplate>
Comments
Post a Comment