If you’re used to .net server controls, you’ll probably want to set the checked property on a checkbox control to true. Well that won’t work.
It displays either checked or not checked depending on whether the string checked is one of its attributes.
Here is a way to make it happen in a templated column in a datagrid in old-school .net 1.1:
1) the templated column
<input type="checkbox" onclick="ajaxws_OnCheckBoxChanged(this)"
id='chkgrid$tDownloads$isHomeUse$sdKy$'
>
a) the line must be either the
string "checked" (without the quotes), or nothing at all. You cannot set checked=1, or checked=true, etc.
b) NOTE - we don't have quotes around the stuff, so you can not edit the page in design mode
2) therefore we convert the boolean to a string with a case statement when we do the database query:
(also take care for isNull)
CASE isNull(isHomeUse, 0)
WHEN 1 THEN 'checked'
ELSE ''
END AS isHomeUse
Note: I’m not so good at getting the Eval syntax to work. I don’t like returning an html string from my sql query, but at least this way works. I’d be interested in hearing from someone who can improve on this.
But I won’t hold my breath, since this code seems so 2002.