This is a migrated thread and some comments may be shown as answers.
Model DefaultValue not passing through to PopUp Editor
1 Answer 18 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
daniel asked on 21 Jun 2019, 11:44 AM


We have a grid where we set some datasource model defaultvalues. These then apply to hiddenfor fields on a popup editor template.

This works up to version 2018.3.1017 but does not work in 2019.2.619 and earlier.

Is there a different approach we can take which will work? Or is it a bug?


    .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("_AuthMembership"))


Grid DataSource

.DataSource(dataSource => dataSource
                        .Model(model =>
                            model.Id(p => p.Id);
                            model.Field(p => p.cUsername).DefaultValue(ViewBag.Email);
                            model.Field(p => p.Id).Editable(false);


Editor Template contains

@Html.HiddenFor(model => model.cUsername)  ... but it is always null now with 2019.2.619.

Passing values around in ViewBag shows each page knows about value and it worked in 2018.3.1017.

We want to upgrade for newer controls - what can we do please?



1 Answer, 1 is accepted

Sort by
Telerik team
answered on 26 Jun 2019, 01:38 PM
Hi Daniel,

Thank you for sharing your observations. 

In general, the value set via the DefaultValue configuration should be applied only when the field is nullable. With the latest version of the Kendo UI suite, the serialization has been slightly changed. Now the nullable property is serialized. The string by default is a nullable type and that is why its default value is not applied. 

A GitHub issue is logged which aims to clarify whether the default value has to be always applied or it should be applied only under certain circumstance. The link to the issue could be found here:

As a workaround on how to still apply the default value, you might do it manually. Namely:

1. Subscribe to the BeforeEdit event handler:


2. Apply the value to the relevant field:

function onBeforeEdit(e) {
        e.model.cUserName= "Custom Value";

Let me know in case any questions arise.

Kind regards,
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.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question