Not able to apply skin on Grid

Hi,

I am using razor engine. I have define stylesheet and theme on my master page (_layout.cshtml).
@{ Html.Syncfusion().StyleManager()
.Register(stylesheets =>
{
stylesheets.Add(ComponentType.Grid);
stylesheets.Theme(Skins.Midnight);
}).Render();}

But when I run my application with syncfusion grid, Grid does not show with theme.

My grid code is as follow in my cshtm page register with master page:

@{ Html.Syncfusion().Grid("Grid1")
.Caption("User List")
.Column(column =>
{
column.Add(p => p.gebruiker_id).HeaderText("User ID");
column.Add(p => p.naam).HeaderText("Name");
column.Add(p => p.email).HeaderText("Email ID");
column.Add(P => P.avatar).HeaderText("Avtar");
})
.EnableSorting().SortSettings(sorting => sorting.AllowMultiSorting(true).AllowSorting(true))
.EnablePaging().PageSettings(p => p.PageSize(10).PageCount(3).PagerStyle(PagerStyle.DefaultAndAdvanced).ShowPagerInformation(true).PagerPosition(Position.BottomLeft).AllowPaging(true))
.Datasource(Model)
.Render();
}

Can you please provide me some solutions?




1 Reply

RR Ranjithkumar R G Syncfusion Team September 20, 2011 11:19 AM UTC

Hi Sonam,

Thanks for using Syncfusion products.

Your requirement of applying skin to grid can be achieved by setting the property AutoFormat() in cshtml page. Please refer to the code-snippet below.

[Index.cshtml]

@{ Html.Syncfusion().Grid("Grid1")
.Datasource((IEnumerable)ViewData["data"])
.ActionMode(ActionMode.JSON)
.AutoFormat(Skins.Midnight)
.Column(column =>
{
column.Add(p => p.OrderID).HeaderText("Order ID");
column.Add(p => p.EmployeeID).HeaderText("Employee ID");
column.Add(p => p.CustomerID).AllowEditing(false);
column.Add(p => p.ShipCountry).HeaderText("Ship Country");
column.Add(p => p.OrderDate).HeaderText("Order Date").Format("{0:MM/dd/yyyy}");
column.Add(p => p.Freight).HeaderText("Freight");

})

.EnablePaging()
.EnableSorting()

.Caption("Orders")
.EnableGrouping()

}

Please refer to the below link to download the sample application.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=inlineedit-razor-mvc-630860359.zip

Please let me know if you have any concern.

Regards,
Ranjithkumar.



Loader.
Up arrow icon