PopEdit window with Default Values

4 posts, 1 answers
  1. Patrick
    Patrick avatar
    30 posts
    Member since:
    Jan 2018

    Posted 09 Feb 2018 Link to this post

    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. )     
  2. Patrick
    Patrick avatar
    30 posts
    Member since:
    Jan 2018

    Posted 09 Feb 2018 in reply to Patrick Link to this post

    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.

  3. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 13 Feb 2018 Link to this post

    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.
  4. Patrick
    Patrick avatar
    30 posts
    Member since:
    Jan 2018

    Posted 13 Feb 2018 in reply to Boyan Dimitrov Link to this post

    Thank You.  I figured it was something easy.
Back to Top