Localization of the Edit caption when using GridEditMode.PopUp

4 posts, 0 answers
  1. Michel
    Michel avatar
    18 posts
    Member since:
    Sep 2011

    Posted 29 Jun Link to this post

    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

  2. Eyup
    Admin
    Eyup avatar
    3007 posts

    Posted 01 Jul Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Michel
    Michel avatar
    18 posts
    Member since:
    Sep 2011

    Posted 07 Jul in reply to Eyup Link to this post

    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

  5. Eyup
    Admin
    Eyup avatar
    3007 posts

    Posted 11 Jul Link to this post

    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready