Dynamics CRM 2011 Sub Grids with More Rows and Scroll Bar

Paul Nieuwelaar, 17 May 2012

In Dynamics CRM 2011 we have seen how useful Sub Grids can be to display related records in line with your form. This basically takes the associated view, and shrinks it into an easy to access grid on the form, allowing you to access all important data without requiring lots of clicks.

When configuring a sub grid, you set the number of rows the grid will occupy (how big the sub grid is). This also determines how many records will be display before you have to click ‘Next Page’.

Dynamics CRM 2011 Sub Grids with More Rows and Scroll Bar

As you can imagine, if you are working with many records at a time, this can be difficult and annoying to find the record you are looking for, as you have to click through page by page, only loading a few records at a time.

There is a way to display more records per page, without having an extremely long sub grid. We can do this by adding a scroll bar to the sub grid, which will allow you to access a lot more records in the view without having to click to the next page. To achieve this, we do not need to use any JavaScript; we can simply do it through the form customizations, and sub grid properties.

When viewing the sub grid properties, we can combine two settings which will give us the scroll bar. First enter the max number of records per page; you can enter any number up to 250 here. Because we do not want a sub grid 250 lines long on our form, we also need to set the option to ‘Automatically expand to use available space’.

Dynamics CRM 2011 Sub Grids with More Rows and Scroll Bar

What this will do is show a max of 250 records in our sub grid before having to click to the next page, but it will be contained within the provided space on our form, and use a scroll bar to view other records that do not fit on the screen:

Dynamics CRM 2011 Sub Grids with More Rows and Scroll Bar

If there are not enough records in the view to occupy the available space, the sub grid will dynamically resize to the number of records available, so you don’t need to worry about the sub grid taking up more room than it needs to:

Dynamics CRM 2011 Sub Grids with More Rows and Scroll Bar

That’s all there is to it, you can now easily add a sub grid with a scroll bar and more records per page without the need of JavaScript.