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

Localization of the Edit caption when using GridEditMode.PopUp

3 Answers 251 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michel
Top achievements
Rank 1
Michel asked on 29 Jun 2016, 08:20 PM

Did anyone knows how to localize the caption of the edit dialog when using GridEditMode.PopUp ?

I have found how o localize the button

   columns.Command(commands =>
   {
   commands.Edit().Text(@Localizer["idsEdit"].Value)
   .UpdateText(@Localizer["idsOK"].Value)
   .CancelText(@Localizer["idsCancel"].Value); // The "edit" command will edit and update data items.
   commands.Destroy().Text(@Localizer["idsDelete"].Value); // The "destroy" command removes data items.
   }).Title(@Localizer["idsCommands"].Value).Width(220);

but not the caption.

Any ideas ?

Best regards

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 01 Jul 2016, 12:57 PM
Hello Michel,

You can achieve this requirement using the Edit event provided by Kendo grid:
http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-edit

When the form is opened, you can access the generated pop-up element and change its title text. Here are some samples you can try:
http://www.telerik.com/forums/changing-title-at-runtime
http://www.telerik.com/forums/help-with-a-tittle-popup-edit
http://stackoverflow.com/questions/21284566/how-to-change-caption-of-popup-kendo-grid-by-html-helper-in-add-window

I hope this will prove helpful.


Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Michel
Top achievements
Rank 1
answered on 07 Jul 2016, 04:53 PM

Thanks Eyup.

As I would like to be as near as I can from standard razor view of ASP.NET CORE 1.0 I have finally used the "Title" property of the edit window. It is (for me) simpler than to add a script. Here is the complete code that can help. I have include localization ASP.NET 1.0 feature for column, button and deleteconfirmation message. The localized string are in standard resource file.

 

  @using Microsoft.AspNetCore.Mvc.Localization
  @inject IViewLocalizer Localizer
  @using Kendo.Mvc.UI


  @(Html.Kendo().Grid<TA_ACCESSORY_ACC>(Model)
     .Name("Accessories")
     .ToolBar(tools => tools.Excel().Text(@Localizer["idsExcelExport"].Value))
     .Excel(excel => excel.FileName(@Localizer["idsAccessories"].Value + ".xlsx"))
     .Columns(columns =>
         {
         columns.Bound(model => model.NAME_ACC);
         columns.Bound(model => model.NUMBERID_ACC);
         columns.Bound(model => model.SERIALNUMBER_ACC);
        columns.Bound(model => model.TYPE_ACC);
        columns.Command(command =>
           {
           // Edit and update
           command.Edit().Text(@Localizer["idsEdit"].Value)
                                    .UpdateText(@Localizer["idsOK"].Value)
                                    .CancelText(@Localizer["idsCancel"].Value);
         // Delete
         command.Destroy().Text(@Localizer["idsDelete"].Value);
         }).Title(@Localizer["idsCommands"].Value).Width(220);
       })
     .Editable(editable => { editable.Mode(GridEditMode.PopUp);
                                         editable.DisplayDeleteConfirmation(@Localizer["idsConfirmDelete"].Value);
                                         editable.TemplateName("AccessoryEditor");
                                         editable.Window(window => window.Title(@Localizer["idsTitle"].Value));
                                        })
     .DataSource(dataSource => dataSource
     .Ajax()
     .Model(model => model.Id(m => m.GUID_ACC))
     .Update(update => update.Action("Update", "Accessory"))
     .Destroy(destroy => destroy.Action("Destroy", "Accessory"))
     )   
   )

Regards

Michel Laplane - ShareVisual - Microsoft Visio MVP

0
Eyup
Telerik team
answered on 11 Jul 2016, 08:26 AM
Hi Michel,

Thanks for sharing your specific solution with our community.
Please feel free to turn to us if new questions arise.

Regards,
Eyup
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Michel
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Michel
Top achievements
Rank 1
Share this question
or