asp.net mvc: default model binder problem

前端 未结 3 1032
谎友^
谎友^ 2021-01-17 04:02

I\'ve got a MVC 3 view which displays a list of items that can be filtered by date.

The filter is a textbox which has been jQueryUI-fied into a date picker.

3条回答
  •  深忆病人
    2021-01-17 04:44

    you can add a new route to routing table using

    routes.MapRoute(
    "SearchRoute", 
    "{controller}/{action}/{id}",
    new {controller = "Home", action = "Index", reportedDate = UrlParameter.Optional} 
    );
    

    then the your url will become

    MyController/Search/30-05-2011
    

    that will make your controller action catch the value of reportedDate

    but you have to chaneg the date format you used in your date picker

提交回复
热议问题