lundi 1 février 2016

Gridview update checkbox always null

<EditItemTemplate>
   <asp:CheckBox ID="CheckBox1" runat="server" 
      Checked='<%# Eval("status") == DBNull.Value ? false : Convert.ToBoolean(Eval("status")) %>' />
</EditItemTemplate>
<ItemTemplate>
   <asp:CheckBox ID="CheckBox1" runat="server" 
      Checked='<%# Eval("status") == DBNull.Value ? false : Convert.ToBoolean(Eval("status")) %>' Enabled="false" />
</ItemTemplate>

"status" is a bit field in the database. Whether this field is checked or not upon update, the result is always "null" in the database. How do I pass in the proper values (0 or 1) on update?




Aucun commentaire:

Enregistrer un commentaire