This is a migrated thread and some comments may be shown as answers.

Data Type Conversion

2 Answers 17 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
n/a
Top achievements
Rank 1
n/a asked on 03 Aug 2019, 03:06 AM

Newbie question: my boolean values are stored as int in Sqlite database. I therefore treat them as int in my model and viewmodel, but I want to treat them as boolean (true/false) in my RadDataForm. Is the proper way to do this by implementing IValueConverter, turning autogeneratefields off, defining customized fields via a data template, and applying said converter to all boolean fields? Or is there are quicker approach?

Wayne

2 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 05 Aug 2019, 10:21 AM

Hello Wayne,

The IValueConvert option that you already described would be the way to go if you want to approach the problem from the RadDataForm side. However, in my opinion (without having the whole picture) it would be easier to store the integer values (from the database) as booleans (in the view model). This way you will need to implement only the conversion when you fetch the data from the database. And when you need to send the values back to the database.

Regards, Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
n/a
Top achievements
Rank 1
answered on 05 Aug 2019, 10:25 AM

Hi Martin,

Thanks for your response. That is where I ended up as about 1 hour ago (handling everything in my data access layer) and I concur completely with your advice!

Thanks,

Wayne

Tags
DataForm
Asked by
n/a
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
n/a
Top achievements
Rank 1
Share this question
or