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

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

rdmrdm Posts: 194Questions: 55Answers: 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: 63,516Questions: 1Answers: 10,472 Site admin
    Answer ✓
                        .Field(new Field("active")
                            .SetFormatter((val, data) => (string)val == "" ? 0 : 1)
                        )
    

    Should do it.

    Allan

This discussion has been closed.