Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Convert integervalues to booleans with checkboxfield ( in datagrid )

Reply
Thread Tools

Convert integervalues to booleans with checkboxfield ( in datagrid )

 
 
Tommy DN
Guest
Posts: n/a
 
      04-18-2008
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.
 
Reply With Quote
 
 
 
 
Stan
Guest
Posts: n/a
 
      04-24-2008
On 18 Apr, 13:31, Tommy DN <tommy...@gmail.com> wrote:
> 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)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing a CheckBoxField =?Utf-8?B?ZHdnMTAxMQ==?= ASP .Net 0 07-22-2006 07:15 PM
reference a checkboxfield from the code-behind graphicsxp ASP .Net 1 07-14-2006 01:06 PM
CheckBoxField in GridView Tasks - Edit Column can it be a CommandField too? hazz ASP .Net 2 04-28-2006 01:39 PM
Checkboxfield Storing 1 instead of -1 for True mike.aes@gmail.com ASP .Net 3 01-17-2006 09:56 PM
checkBoxField on gridView =?Utf-8?B?QnJhZA==?= ASP .Net 3 12-22-2005 08:02 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57