c# - Databind a 0 or 1 Value to CheckBox -
if using sqldatasource bound data grid, how extend check box control read value query passing , checking or unchecking box because of that?
i have tried this:
public class checkboxyn : system.web.ui.webcontrols.checkbox { public string yesno { { if (this.checked) return "1"; else return "0"; } set { if (value == "1") this.checked = true; else this.checked = false; } } }
but can't find control in asp.net, errors in html.
you don't need override checkbox class, bind checked property datasource's bit column:
<asp:checkbox checked='<%# eval("bitcolumnname") %>' />
Comments
Post a Comment