Skip to content

Commit e6541bb

Browse files
committed
Fix binder
1 parent 724c978 commit e6541bb

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Mvc.JQuery.Datatables.Example/Mvc.JQuery.Datatables.Example.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
<DesignTime>True</DesignTime>
8686
<DependentUpon>UserViewResource.resx</DependentUpon>
8787
</Compile>
88+
<Compile Include="RegisterDatatablesModelBinder.cs" />
8889
<Compile Include="Controllers\FakeDatabase.cs" />
8990
<Compile Include="Controllers\FriendlyDateHelper.cs" />
9091
<Compile Include="Controllers\HomeController.cs" />
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
using Mvc.JQuery.Datatables.Example;
7+
8+
[assembly: PreApplicationStartMethod(typeof(RegisterDatatablesModelBinder), "Start")]
9+
10+
namespace Mvc.JQuery.Datatables.Example
11+
{
12+
13+
public static class RegisterDatatablesModelBinder
14+
{
15+
public static void Start()
16+
{
17+
if (!ModelBinders.Binders.ContainsKey(typeof (DataTablesParam)))
18+
ModelBinders.Binders.Add(typeof (DataTablesParam), new Mvc.JQuery.Datatables.DataTablesModelBinder());
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)