1

I'm using MVC 4/Razor date picker: '@Html.DatePickerDropDowns' and what I would like to know is if there is a way to change the order of theses drop downs from Day/Month/Year to Month/Day/Year. If there is not a way, then I suppose I'll just use a 'JQuery date picker or individual drop downs.

4

1 回答 1

1

I don't think that method is part of MVC out of the box. Are you talking about the extension method as defined here: anybody has some dropdowns datepicker for asp.net mvc?

If so, then it should be easy for you to change this method to cover your needs.

The order of the drop downs is dictated in the return line. Changing this line to return string.Concat(monthsList.ToString(), daysList.ToString(), yearsList.ToString()); should get you what you want.

Of course, if you are looking for a bigger challenge, you could take this one step further and allow the user to pass the desired order of the fields as a parameter.

于 2013-07-22T21:58:12.213 回答