Populating a RadCheckBox from an int column in a datarow

1 Answer 78 Views
Ajax CheckBox
CP
Top achievements
Rank 1
Iron
CP asked on 24 May 2023, 11:33 AM

I haven't used Telerik for some time and I'm trying to add a RadCheckBox whose datasource is an integer value in a column of a datarow. In the web page I've got this :

<telerik:RadCheckBox ID="chkProrataEnabled" runat="server" text="" TabIndex="7" Value='<%# DataBinder.Eval(Container, "DataItem.Prorata_Enabled") %>' autopostback="false" OnCheckedChanged="chkProrataEnabled_CheckedChanged">
</telerik:RadCheckBox>

but the check box is not being populated so I'm thinking some form of conversion from int to bool is required but not sure how to go about this. I was thinking I could change the DataBinder.Eval to check the integer value and return a true/false bool ?

 

1 Answer, 1 is accepted

Sort by
0
CP
Top achievements
Rank 1
Iron
answered on 25 May 2023, 09:28 AM

Found it.

<telerik:RadCheckBox ID="chkProrataEnabled" runat="server" text="" Checked='<%# !((int)DataBinder.Eval(Container, "DataItem.Prorata_Enabled") == 0) %>' autopostback="false" TabIndex="7" >

 

 

Tags
Ajax CheckBox
Asked by
CP
Top achievements
Rank 1
Iron
Answers by
CP
Top achievements
Rank 1
Iron
Share this question
or