Skip to content

Commit 4757109

Browse files
committed
Fixed Griddly for MVC5
1 parent 3e62bee commit 4757109

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

Griddly.Mvc/GriddlySettingsResult.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static GriddlySettings GetSettings(ControllerContext context, string view
6161
{
6262
throw;
6363
}
64-
catch
64+
catch (Exception ex)
6565
{
6666
// TODO: throw exception if it is bad like HttpCompileException
6767
return null;
@@ -114,6 +114,12 @@ public override PageInstrumentationService PageInstrumentation
114114
return _pageInstrumentation;
115115
}
116116
}
117+
118+
//http://stackoverflow.com/a/24348822/65611
119+
public override object GetService(Type serviceType)
120+
{
121+
return DependencyResolver.Current.GetService(serviceType);
122+
}
117123
}
118124

119125
class EmptyHttpRequest : HttpRequestBase

Griddly/Views/Home/FilterBoxGrid.cshtml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@
66
@Html.Griddly(new GriddlySettings<TestGridItem>()
77
{
88
PageSize = 5,
9-
RowClickUrl = x => "http://microsoft.com"
9+
RowClickUrl = x => "http://microsoft.com",
10+
Buttons = new List<GriddlyButton>()
11+
{
12+
new GriddlyButton() { Text = "Dropdown Test" }
13+
.Add(new GriddlyButton() { Text = "UrlHelper Test", Argument = Url.Action("About") })
14+
}
1015
}
1116
.TemplateColumn(@<a href="http://google.com">google</a>, "test")
12-
.Column(x => x.Test)
17+
.Column(x => x.Test)
1318
.Column(x => x.FirstName, "First Name")
14-
.Column(x => x.LastName, "Last Name", defaultSort: SortDirection.Ascending, filter: x => x.FilterBox(FilterDataType.String))
15-
.Column(x => x.Company, "Company", filter: x => x.FilterBox(FilterDataType.Decimal))
16-
.Column(x => x.Address, "Address", filter: x => x.FilterBox(FilterDataType.Currency))
17-
.Column(x => x.City, "City", filter: x => x.FilterBox(FilterDataType.Date))
18-
.Column(x => x.PostalCode, "Zip", filter: x => x.FilterBox(FilterDataType.Integer))
19+
.Column(x => x.LastName, "Last Name", defaultSort: SortDirection.Ascending, filter: x => x.FilterBox(FilterDataType.String))
20+
.Column(x => x.Company, "Company", filter: x => x.FilterBox(FilterDataType.Decimal))
21+
.Column(x => x.Address, "Address", filter: x => x.FilterBox(FilterDataType.Currency))
22+
.Column(x => x.City, "City", filter: x => x.FilterBox(FilterDataType.Date))
23+
.Column(x => x.PostalCode, "Zip", filter: x => x.FilterBox(FilterDataType.Integer))
1924
)

0 commit comments

Comments
 (0)