Articles in this section
Category / Section

How to define localized values for multiple Grids in .NET Web Forms?

3 mins read

In the Grid localization, the localized values are provided in the script section and it can be placed in the master page of the application.               

The Grid control allows you to set the localized values for the Grid by using the locale property of the Grid as explained in the following link:

https://www.syncfusion.com/kb/4008/how-to-enable-localization-in-grid

In an application, there may be several Grid controls in several webpages. In that case, instead of defining the localized values for each page, it is better to place the script section of the Grid localized values in the Web Application’s Master page, so that the localized values can be defined commonly for all the Grid controls in the application.

The following code sample demonstrates the same.

ASP

[Site.Master]
<script>
         ej.Grid.locale["de-DE"] = {
             EmptyRecord: "Keine Aufzeichnungen angezeigt",
             GroupDropArea: "Ziehen Sie eine Spaltenüberschrift hier",
             GroupCaptionFormat: "{{:field}}: {{:key}} - {{:count}} {{if count == 1}}Beiträge{{else}}Beiträges{{/if}}",
             UnGroup: "Klicken Sie hier, um die Gruppierung aufheben"   
         };
 
         ej.Pager.locale[“de-DE"] = {
             pagerInfo: "{0} von {1} Seiten ({2} Beiträge)",
             firstPageTooltip: "Zur ersten Seite",
             lastPageTooltip: "Zur letzten Seite",
             nextPageTooltip: "Zur nächsten Seite",
             previousPageTooltip: "Zurück zur letzten Seite",
             nextPagerTooltip: "Zum nächsten Pager",
             previousPagerTooltip: "Zum vorherigen Pager"
         };
    </script>
[Default.aspx]
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Sample._Default" %>
<ej:Grid ID="EmployeesGrid" runat="server" Locale="de-DE" AllowSorting="true" AllowPaging="true" AllowGrouping="true" >
</ej:Grid>

 

MVC

[Layout.cshtml]
<script>
         ej.Grid.locale["de-DE"] = {
             EmptyRecord: "Keine Aufzeichnungen angezeigt",
             GroupDropArea: "Ziehen Sie eine Spaltenüberschrift hier",
             GroupCaptionFormat: "{{:field}}: {{:key}} - {{:count}} {{if count == 1}}Beiträge{{else}}Beiträges{{/if}}",
             UnGroup: "Klicken Sie hier, um die Gruppierung aufheben"   
         };
 
         ej.Pager.locale[“de-DE"] = {
             pagerInfo: "{0} von {1} Seiten ({2} Beiträge)",
             firstPageTooltip: "Zur ersten Seite",
             lastPageTooltip: "Zur letzten Seite",
             nextPageTooltip: "Zur nächsten Seite",
             previousPageTooltip: "Zurück zur letzten Seite",
             nextPagerTooltip: "Zum nächsten Pager",
             previousPagerTooltip: "Zum vorherigen Pager"
         };
    </script> 
[Index.chstml]
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@(Html.EJ().Grid<OrdersView>("FlatGrid")
        .Datasource((IEnumerable<object>)ViewBag.datasource)
        .Locale("de-DE")
        .AllowPaging()
        .AllowGrouping()
 
)

 


Note:

A new version of Essential Studio for ASP.NET is available. Versions prior to the release of Essential Studio 2014, Volume 2 will now be referred to as a classic versions.The new ASP.NET suite is powered by Essential Studio for JavaScript providing client-side rendering of HTML 5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.

The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio for ASP.NET. Although Syncfusion will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls. If you have any queries or require clarifications, please let us know in the comments section below.

You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied