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

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

4 Answers 2311 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 21 Feb 2019, 06:37 PM

 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");
            })
        )
)

4 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 26 Feb 2019, 11:44 AM
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.
Jonatan
Top achievements
Rank 1
commented on 27 Feb 2022, 10:12 PM

how to do it in TagHelper?
0
Shawn
Top achievements
Rank 1
answered on 27 Feb 2019, 12:34 PM

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.

0
Georgi
Telerik team
answered on 04 Mar 2019, 06:27 AM
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.
0
Shawn
Top achievements
Rank 1
answered on 04 Mar 2019, 04:16 PM
Thanks Georgi!  This is exactly what I needed.
Tags
Grid
Asked by
Shawn
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Shawn
Top achievements
Rank 1
Share this question
or