Programmatically overriding language defaults

In some cases, you would wish to keep the majority of the locale settings in your javascript language packs, but still change some of them programmatically based on certain client-side conditions.

The way this works is the following - if a specific value for a property is not specified in the ASPX/C# code, the default from the language pack will be used. If it is specified in code however, it will override the language pack default.

A common example for this is customizing the EditDialog for example. By default (if English language pack is used), the default caption of the dialog and the submit/cancel buttons will have these values (take from grid.locale-en.js):

edit : { editCaption: "Edit Record", bSubmit: "Submit", bCancel: "Cancel" }

If you want to change that however, just set the respective settings in the EditDialogSettings collection of jqGrid, e.g.
<trirand:JQGrid runat="server" ID="JQGrid1" DataSourceID="LinqDataSource1"> <EditDialogSettings Caption="My New Caption" SubmitText="My Submit Text" CancelText="My Cancel Text" /> </trirand:JQGrid>

This principle applies to most options in the grid.

Note: Some options in the javascript language pack do not have their respective counterparts in the server-side grid code, so they can be changed only in the javascript file.


  Last Updated: 11/13/2009 | © Trirand, 2009