How to change a PopUp window's Title (GridEditMode.PopUp)

5 posts, 0 answers
  1. Shawn
    Shawn avatar
    66 posts
    Member since:
    Jun 2014

    Posted 21 Feb 2019 Link to this post

     Hello,

    I'm very new to developing in ASP.NET Core and Telerik's Keno UI.  I'm trying to find documentation on how I can change the title of a grid popup window when I click on the "Add New Record" button on top of the Grid.  Currently, the word "Edit" is displayed even though the operation is for "insert".  How do I go about changing the title of a popup add/edit window for a Grid?

    Here's my code:

    @(Html.Kendo().Grid<MyApp.Models.Project>
                ()
                .Name("Projects")
                .Columns(columns =>
                {
                    columns.Bound(c => c.ProjectName).Width(100);
                    columns.Bound(c => c.ProjectDescription).Width(100);
                    columns.Bound(c => c.Address);
                    columns.Bound(c => c.City).Width(100);
                    columns.Bound(c => c.State).Width(100);
                    columns.Bound(c => c.ZipCode).Width(50);
                    columns.Bound(c => c.ContactName);
                    columns.Bound(c => c.PhoneNumber);
                    columns.Bound(c => c.Email);
                })
                .HtmlAttributes(new { style = "height: 380px;" })
                .Scrollable()
                .Groupable()
                .Sortable()
                .Pageable(pageable => pageable
                .Refresh(true)
                .PageSizes(true)
                .ButtonCount(5))
                .ToolBar(toolbar => toolbar.Create())
                .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("_ProjectCreate"))
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Events(events => {
                        events.Error("error_handler");
                    })
                    .ServerOperation(false)
                    .Read(read => read.Action("GetProjects", "Projects"))
                    .Create(create => {
                        create.Action("Create", "Projects");
                })
            )
    )
  2. Georgi
    Admin
    Georgi avatar
    703 posts

    Posted 26 Feb 2019 Link to this post

    Hello Shawn,

    You can customize the title of the popup editor using the Editable.Window.Title configuration.

    e.g.

    .Editable(editable => editable.Mode(GridEditMode.PopUp).Window(w=> w.Title("Custom Title")))


    Regards,
    Georgi
    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.
  3. Shawn
    Shawn avatar
    66 posts
    Member since:
    Jun 2014

    Posted 27 Feb 2019 in reply to Georgi Link to this post

    Hello Georgi,

    Thanks for the reply.  I'm wondering if there is a way to have a different title for the popup window depending on when it's in "Edit" mode vs. when it's in "Insert" mode.  If I change the title as you suggested above, the same title will be displayed for both Insert and Edit popup windows, unless I'm missing something obvious.  Thanks.

    Regards,

    Shawn A.

  4. Georgi
    Admin
    Georgi avatar
    703 posts

    Posted 04 Mar 2019 Link to this post

    Hello Shawn,

    If you would like to change the title of the popup window dynamically I can suggest you to do it within the Edit event handler.

    e.g.

    // attach event handler
     
    .Events(x=> x.Edit("onEdit"))
     
    //edit event handler
     
    function onEdit(e){
                  var window =  e.container.data('kendoWindow')
                  if(e.model.isNew()){
                    window.title('Title for create');
                  }else{
                    window.title('Title for edit');
                  }
    }

    Using the above approach you can set different titles depending on the operation.


    Regards,
    Georgi
    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.
  5. Shawn
    Shawn avatar
    66 posts
    Member since:
    Jun 2014

    Posted 04 Mar 2019 in reply to Georgi Link to this post

    Thanks Georgi!  This is exactly what I needed.
Back to Top