Convert integervalues to booleans with checkboxfield ( in datagrid )

T

Tommy DN

I'm using a datagrid wich uses a dataset.table as datasource.
One field is a integerfield with 1 and 0

Is there a possibility to bind this with a checkboxfield ( using
inheritance for example ? ).
When it's a 0, the checkbox for the cell must be checked and when it's
a 1 it must be unchecked.

So 0 and 1 should be converted to a boolean.
 
S

Stan

I'm using a datagrid wich uses a dataset.table as datasource.
One field is a integerfield with 1 and 0

Is there a possibility to bind this with a checkboxfield ( using
inheritance for example ? ).
When it's a 0, the checkbox for the cell must be checked and when it's
a 1 it must be unchecked.

So 0 and 1 should be converted to a boolean.

Suppose your integer field is called "with_sugar" where a 1 means with
sugar and a 0 means without sugar.

The checked property of a databound checkbox control could have the
following binding expression:

checked='<%# (int)Eval("with_sugar") == 1 %>' (host page language C#)
or

checked='<%# Eval("with_sugar") = 1 %>' (host page language VB)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top