Hello -
I need to have multiple grids to a single asp.net MVC page? To add even more complexity the number of grids is variable also. I might be able to accomplish it with a hierarchical grid but thought I would explore this first. Thanks much
Hello Andrew,
The data for the models could be defined in the controller and passed to the view. Furthermore the grids could be defined in a @for loop in the view and bound to the model as follows:
@for(int i = 0; i < 2; i++)
{
@(Html.Infragistics().Grid(Model.Customers.AsQueryable())
.ID("grid" + i)
.AutoGenerateColumns(true)
.DataBind().Render())
}
Below I am attaching the modified sample. Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me along with steps to reproduce.
Looking forward to hearing from you.
Regards, Monika Kirkova, Infragistics
MultipleGrids.zip
Thanks very much. I will try this out. I have mostly been using MVC and writing the code in the controller. Is that possible also? thanks very much
After investigating this further, I determined that multiple grids could be defined in one page. Number of grids based on a variable could be rendered by defining the grids in a loop. I have prepared a sample, demonstrating the described behavior. The defined grids contain only basic options, however there is no problem in defining other options as well:
$(function () {
for (var i = 1; i < numberGrids + 1; i++) {
var grid = "grid" + i;
$("#" + grid).igGrid({
autoGenerateColumns: true,
width: "500px",
dataSource: products[i - 1]
});
Below I am attaching the sample. Please test it on your side and let me know if you need any further information regarding this matter.
Regards,
Monika Kirkova,
Infragistics
MultipleIgGrids.zip