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

PopEdit window with Default Values

3 Answers 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 09 Feb 2018, 08:29 PM

I have an editable grid with a custom template:

1..Editable(editable => editable
2.    .Mode(GridEditMode.PopUp)
3.    .Window(w => w.Width(600))
4.    .TemplateName("Inspection")
5. )     

3 Answers, 1 is accepted

Sort by
0
Patrick
Top achievements
Rank 1
answered on 09 Feb 2018, 08:32 PM

In the template I have two drop downs.

01.@(Html.Kendo().DropDownListFor(model => model.CloseoutStatusID)
02.    .DataValueField("LookUpID")
03.    .DataTextField("LookUpText")
04.    .DataSource( source => {
05.        source.Read(read =>
06.        {
07.            read.Action("Get", "LookUp", new { LookUp = "CloseOutStatus" });
08.        });
09.    })
10.    )

 

and

@(Html.Kendo().DropDownListFor(model => model.InspectionStatus)
.BindTo(new List<SelectListItem>()
{
    new SelectListItem() { Text = "Pass", Value = "1" },
    new SelectListItem() { Text = "Fail", Value = "0" }
})
)

 

In the model they are both set to required and have default values...

1.[Required]
2.[DefaultValue(true)]
3.public int InspectionStatus { get; set; }
4. 
5.[Required]
6.[DefaultValue(2)]
7.public int CloseoutStatusID { get; set; }

 

When I try to add a new item the default values do not display.... the bool returns a false and the int returns a 0 by default.

0
Accepted
Boyan Dimitrov
Telerik team
answered on 13 Feb 2018, 01:03 PM
Hello,

According to https://docs.telerik.com/aspnet-mvc/getting-started/fundamentals article Telerik UI for ASP.NET MVC eventually comes to JavaScript widgets. Create button in the toolbar creates an item on the client-side and takes information about the default value from the DataSource on the client-side. The default value should be set on DataSource level as shown in the https://demos.telerik.com/aspnet-mvc/grid/editing-custom demo and specifically for the Category field. 

Regards,
Boyan Dimitrov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Patrick
Top achievements
Rank 1
answered on 13 Feb 2018, 01:09 PM
Thank You.  I figured it was something easy.
Tags
Grid
Asked by
Patrick
Top achievements
Rank 1
Answers by
Patrick
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or