I am going to take a stab
Checked='<%# BindItem.databaseValue ?? false %>'
I think this works with Item (AKA Eval) anyway. CheckBox is weird.
Вопрос
Im leveraging model binding in my ASP.Net WebForms application, facing problem while binding nullable bit to checkbox, in my aspx page i have something like
<li>IS A ChkBox</li>
<li>
<asp:CheckBox ID="someid" runat="server"
MaxLength="100" Checked='<%# BindItem.databaseValue%>'>
</asp:CheckBox>
</li>
initially when the form is populated the value is null and i get a NullReferenceException
, Object reference not set to an instance of an object.
, how can i get around this.
Regards
Нет правильного решения
Другие советы
I am going to take a stab
Checked='<%# BindItem.databaseValue ?? false %>'
I think this works with Item (AKA Eval) anyway. CheckBox is weird.