Convert integervalues to booleans with checkboxfield ( in datagrid )

Discussion in 'ASP .Net Web Controls' started by Tommy DN, Apr 18, 2008.

  1. Tommy DN

    Tommy DN Guest

    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.
     
    Tommy DN, Apr 18, 2008
    #1
    1. Advertising

  2. Tommy DN

    Stan Guest

    Re: Convert integervalues to booleans with checkboxfield ( indatagrid )

    On 18 Apr, 13:31, Tommy DN <> 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)
     
    Stan, Apr 25, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QnJhZA==?=

    checkBoxField on gridView

    =?Utf-8?B?QnJhZA==?=, Dec 21, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    21,492
    bhawin13
    Dec 22, 2005
  2. Replies:
    3
    Views:
    449
    Jon Paal
    Jan 17, 2006
  3. hazz
    Replies:
    2
    Views:
    10,010
  4. graphicsxp
    Replies:
    1
    Views:
    2,626
    Ray Booysen
    Jul 14, 2006
  5. =?Utf-8?B?ZHdnMTAxMQ==?=

    Accessing a CheckBoxField

    =?Utf-8?B?ZHdnMTAxMQ==?=, Jul 22, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    446
    =?Utf-8?B?ZHdnMTAxMQ==?=
    Jul 22, 2006
Loading...

Share This Page