We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Controlling grid dimensions?

Silly question but how do you control basic size attributes of the MVC Grid? I would have thought that these attributes would be painfully obvious in the namespace but I can't find them. I'll assume they are buried further down somewhere.

The resulting HTML produces a div with it's size set to an arbitrary width. I need to make the grid's height and width larger to fill up it's container.


3 Replies

KD Krishnaraj D Syncfusion Team October 13, 2010 05:43 PM UTC

Hi Greg Clouston,

Thanks for evaluating Syncfusion Products. The response for this query has been updated in the incident 73089 also.

We have categorized the size attributes under scrolling and therefore to specify the basic size attributes in View, please refer to the below mentioned code snippet.

<%=Html.Grid("Grid1")
.Datasource(Model)
. . . . . . . .
. . . . . . . .
//Setting the size attributes of grid and width
.Scrolling(size =>
{
size
.Height(210)
.Width(1200);
})

.EnablePaging()
.EnableSorting()
.AutoFormat(Skins.Sandune)

%>

We will provide explicit support for specifying the size attributes in Grid builder in our volume1 2011 release.

For more details about setting the size attributes through builder, please refer our online documentation in the below link.

http://help.syncfusion.com/ug_83/User%20Interface/ASP.NET%20MVC/Grid/default.htm?turl=Documents%2Fthroughgridbuilder15.htm

To Control the size attributes from the controller, you can directly set the width and height of GridPropertiesModel as below.

GridPropertiesModel model = new GridPropertiesModel
{
DataSource = new NorthwindDataContext().Orders.Take(100).ToList(),
AutoFormat = Syncfusion.Mvc.Shared.Skins.Sandune
};
//Setting height and width of grid. This will apply only if you set AllowScrolling to true.
model.Height = 210;
model.Width = 1200;
model.AllowScrolling = true;



For more details about setting the size attributes through controller, please refer our online documentation in the below link.

http://help.syncfusion.com/ug_83/User%20Interface/ASP.NET%20MVC/Grid/default.htm?turl=Documents%2Fthroughgridpropertiesmodel15.htm

Please let us know if you have any queries.

Regards,
Krishnaraj D






GC Greg Clouston October 14, 2010 12:31 PM UTC

Thanks that worked.

I'm curious to know why this isn't mentioned anywhere in the products documentation.



KD Krishnaraj D Syncfusion Team October 20, 2010 01:04 PM UTC


Hi Greg Clouston,

Good to hear that you have everything working. And the documentation for setting the size attributes is available in the below links.

http://help.syncfusion.com/ug_83/User%20Interface/ASP.NET%20MVC/Grid/default.htm?turl=Documents%2Fthroughgridbuilder15.htm

http://help.syncfusion.com/ug_83/User%20Interface/ASP.NET%20MVC/Grid/default.htm?turl=Documents%2Fthroughgridpropertiesmodel15.htm


Please let us know if you have any queries.

Regards,
Krishnaraj D


Loader.
Live Chat Icon For mobile
Up arrow icon