40
igGrid Error parsing the XML string when using DataSourceUrl
posted

Hi,

I have an igGrid with a remote datasource. I also have a button which when clicked, rebinds the grid data from source. However, this is causing a javascript runtime error: Parsing XML String: Syntax Error. My controller and view are as below. The grid loads correctly when the page is loaded the first time, but causes the error during button click when re-binding with remote source.

View:

-----------------------

@model IQueryable<Application.Models.Request>
@(Html.Infragistics()
.Grid(Model)
.ID("invGrid")
.AutoGenerateColumns(false)
.PrimaryKey("ID")
.UpdateUrl(Url.Action("RequestsSaveData"))
.Columns(column =>
{
column.For(x => x.ID).HeaderText("ID").Hidden(true);
column.For(x => x.Name).HeaderText("Name");
column.For(x => x.Status).HeaderText("Status");
})
.Features(f =>
{
f.Updating()
.EnableAddRow(true)
.EnableDeleteRow(true)
.EditMode(GridEditMode.Dialog)
.RowEditDialogOptions(options =>
{
options.ShowReadonlyEditors(false);
options.Height("600px");
options.Width("500px");
})
})
.DataSourceUrl(Url.Action("ListRequests"))
.DataBind()
.Render())

<script>

$("#button").on('igbuttonclick',
function (e) {
$("#iGrid").igGrid("dataBind");
});

</script>

Controller:

--------------------

public ActionResult ListRequests()
{
List<Request> model = db.Requests.ToList();
return View(model.AsQueryable());
}

Regards,

Guru

  • 15320
    Offline posted

    Hello Guru,

    This error sounds me like generic error, which does not have much in common with the grid. It may be caused due to not well-formated XML file, but this is only assumption based on similar issues online. Do you perfrorm any actions before calling grid databind? Did you try to decorate the Action method that returns your data with GridDataSourceAction  attrbute? Can you send me the whole Controller's code and your model. If you can send me even the whole project in order I can run and test it locally would be great appreciated.

    Regards,

    Tsanna