ASP.NET Binding integer to CheckBox's Checked field

前端 未结 6 1111
Happy的楠姐
Happy的楠姐 2021-01-12 13:11

I have a following ListView item template, in which I am trying to bind integer value to Checked property of CheckBox.

IsUploaded value con

6条回答
  •  天涯浪人
    2021-01-12 13:26

    If you're willing to change the class, add a property on the class that's a boolean

    public bool IsUploadedBoolean
    {
       get { return IsUploaded != 0; }
       set { IsUploaded = value ? 1 : 0; }
    }
    

    If not, you may have success with a TypeConverter:

    1. Create a custom TypeConverter which will handle 0 and 1 to boolean conversions
    2. Stick the TypeConverterAttribute on the IsUploaded property to direct .NET to your custom typeconverter.

提交回复
热议问题