C# equivalent to PHP example on "Permanent inline checkboxes"

C# equivalent to PHP example on "Permanent inline checkboxes"

rdmrdm Posts: 192Questions: 54Answers: 4

Because I'm trying to get a column checkbox in my table set up, I'm looking at the Permanent Inline Checkboxes blog post.

I have everything in place except for that little bit of server-side code.

Does anyone know the C# equivalent to this fragment?

Field::inst( 'active' )
            ->setFormatter( function ( $val, $data, $opts ) {
                return ! $val ? 0 : 1;
            } )

I also checked Formatters and looked for PHP to C# online converters. No luck there.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓
                        .Field(new Field("active")
                            .SetFormatter((val, data) => (string)val == "" ? 0 : 1)
                        )
    

    Should do it.

    Allan

This discussion has been closed.