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
105
Handle an array inside a list an infragistics ignite datagrid
posted

I am wondering if anyone could help with a problem I am having using the Infragistics ignite data grid. I am using the Infragistics.Web.Mvc .net library. The issue is that I have an array inside my list which is filling the grid. I want to be able to display each value in the array in a separate column. This works in my view for example.

@foreach (var item in Model) {
var firstname = item.BillToContact.FirstName;
var lastname = item.BillToContact.LastName;
foreach (var number in item.BillToContact.PhoneNumbers) {
@Html.DisplayFor(modelItem => firstname )
@Html.DisplayFor(modelItem => lastname )
@Html.DisplayFor(modelItem => number.Number)
}
}
However when I try to do this inside my datagrid in any shape of form the column remains empty. I was trying simple way to output into the grid approach in the snippet below.

.Columns(col =>
{
// problem is here
col.For(c => c.BillToContact.PhoneNumbers[0].Number).HeaderText("PhoneNumbers1").Width("200px");

col.For(c => c.ID).HeaderText("ID").Width("100px");
col.For(c => c.Name).HeaderText("Name").Width("200px");
col.For(c => c.BillToContact.Name).HeaderText("BillToContactName").Width("200px");
col.For(c => c.BillToContact.Title).HeaderText("Title").Width("200px");
})

Would anyone know how to display the contents of an array were each value is in a separte column which is inside a library which is the datasource for a Infragistics ignite data grid.?

Parents
  • 11095
    Offline posted

    Hello Anthony,

    Thank you for contacting Infragistics Developer Support!

    Your data source is hierarchical and the grid accepts only flat data source. You have two options:

    1) To modify your data source in order to be flat

    2) Use unbound columns and formula for displaying the content. I have attached a small project sample demonstrating the following, which you can find attached to the this reply.

    I would strongly suggest the first approach, transforming your data source before passing it to the grid, because using formula and unbound columns could affect some grid features.

    Please let me know if you need further assistance.

    GridWithArrayInDifferentColumns.zip
Reply Children