Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
385
DataBind JSON Error
posted

Hello,

I have a problem when calling igGrid("Databind') method on igGrid to refresh Data after having add a new record.

Here is the configuration of igGrid :

 <%= Html.Infragistics().Grid(Model.ListeSites).ID("Sites").DataSourceUrl(Url.Action("GetListe")).AutoCommit(true).PrimaryKey("Site").AutoGenerateColumns(false).EnableHoverStyles(false).Columns(column =>
    {
        column.For(x => x.Site).HeaderText("Site").Width("45");
        column.For(x => x.Description).HeaderText("Description").Width("150");
        column.For(x => x.Nom).HeaderText("Nom").Width("100");
        column.For(x => x.Adresse1).HeaderText("Adresse 1").Width("100");
        column.For(x => x.Adresse2).HeaderText("Adresse 2").Width("100");
        column.For(x => x.CodePostal).HeaderText("Code postal").Width("100");
        column.For(x => x.Ville).HeaderText("Ville").Width("90");
        column.For(x => x.Contact).HeaderText("Contact").Width("90");
        column.For(x => x.Telephone).HeaderText("Téléphone").Width("90");
        column.For(x => x.Siret).HeaderText("Siret").Width("90");
    })
        .Features(features =>
        {
            features.Paging().Type(OpType.Local).PageSize(20);
            features.Sorting().Mode(SortingMode.Single);
            if (User.IsInRole(((int)Andra.PriscaND.Business.Model.RoleName.Administrateur).ToString()))
            {
                features.Updating()
                    .EnableAddRow(true)
                    .EnableDeleteRow(true)
                    .EditMode(GridEditMode.Row)
                    .ColumnSettings(settings =>
                    {
                        settings.ColumnSetting().ColumnKey("Site").ReadOnly(false).EditorType(ColumnEditorType.Text).Required(true).Validation(true)
                                                                    .EditorOptions(@"validatorOptions: {requiredMessage: 'Site obligatoire'}, maxLength:3");
                        settings.ColumnSetting().ColumnKey("Description").EditorType(ColumnEditorType.Text).Required(true)
                            //.EditorOptions(@"validatorOptions: {errorLabel: 'GridValidation', onChange: true}");
                                                                    .EditorOptions(@"validatorOptions: {requiredMessage: 'Description obligatoire'}, maxLength:250");
                        settings.ColumnSetting().ColumnKey("Nom").ReadOnly(false).EditorOptions("maxLength:50");
                        settings.ColumnSetting().ColumnKey("Adresse1").ReadOnly(false).EditorOptions("maxLength:50");
                        settings.ColumnSetting().ColumnKey("Adresse2").ReadOnly(false).EditorOptions("maxLength:50");
                        settings.ColumnSetting().ColumnKey("CodePostal").ReadOnly(false).EditorOptions("maxLength:20");
                        settings.ColumnSetting().ColumnKey("Ville").ReadOnly(false).EditorOptions("maxLength:50");
                        settings.ColumnSetting().ColumnKey("Contact").ReadOnly(false).EditorOptions("maxLength:50");
                        settings.ColumnSetting().ColumnKey("Telephone").ReadOnly(false).EditorOptions("maxLength:20");
                        settings.ColumnSetting().ColumnKey("Siret").ReadOnly(false).EditorOptions("maxLength:14");
                    });
            }
        }).DataBind().Render()

Then the JS code that generates error :

 $("#Sites").igGrid("dataBind");

Here is the error from Firefox :

Error: There was an error parsing/evaluating the JSON string: JSON.parse: unexpected character
http://localhost:49944/Scripts/infragistics.js
Line 51

And loading panel remains turning around and nothing more happens.

Tank's by advance.

Regards,

Hardis