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

ForeignKey change not detected and values not POSTed

3 Answers 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vince
Top achievements
Rank 1
Vince asked on 05 Feb 2019, 07:10 PM

I recently upgraded from a 2016 version of Kendo to 2018.

All foreign key values that were bound to int? (notice the ?, this is specific to Nullable<T>) are not saving.

I managed to fix this in some cases by adding the bolded:

columns.ForeignKey(p => p.IndexId, (System.Collections.IEnumerable)ViewData["indexNames"], "Id", "Name").Title("Index").Width(60).HtmlAttributes(new { data_value_primitive = "true" });

In some cases though, the bold doesn't work.

So my question is why do primative FK columns involving Nullable<T> (seems to be primitives only, as GUID? as FKs work) break when they used to work?

3 Answers, 1 is accepted

Sort by
0
Vince
Top achievements
Rank 1
answered on 05 Feb 2019, 07:11 PM

Meant Kendo 2019.

You guys need to add an Edit feature on your forums; this is pretty standard by now across all boards.

0
Vince
Top achievements
Rank 1
answered on 06 Feb 2019, 04:08 PM

Managed to fix this using a EditorTemplate

Problem still exists though: I don't know why this worked and how it works, so if somebody does, I'd greatly appreciate a low level understanding. 

0
Konstantin Dikov
Telerik team
answered on 07 Feb 2019, 12:40 PM
Hi Vince,

The HtmlAttributes of the columns is adding the attributes to the TD elements and not to the editor, which is why it does not have any effect. The correct way of handling this would be to use EditorTemplate with configured ValuePrimitive property in the editor directly.


Regards,
Konstantin Dikov
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.
Tags
Grid
Asked by
Vince
Top achievements
Rank 1
Answers by
Vince
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or