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

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -