|
|
|
MVC3 + jQuery (а именно DatePicker)
|
|||
|---|---|---|---|
|
#18+
Здравствуйте У меня есть модель, данные которой я редактирую. В ней есть дата. Как используя DatePicker можно реализовать аналог данной строки @Html.EditorFor(model => model.Birthday) ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 18.01.2012, 15:42:27 |
|
||
|
MVC3 + jQuery (а именно DatePicker)
|
|||
|---|---|---|---|
|
#18+
Ах да, есть примерчик, но не могу понять что указывать в частичном представлении и как реализовывать на View 1.In the Views\Shared folder create a folder called EditorTemplates 2.In the EditorTemplates folder add a partial view called DateTime.cshtml (don't change the name as this will get picked every time you use create an editor for a DateTime property like this @Html.EditorFor( m => m.StartDate) ): @model Nullable<System.DateTime> @if ( Model.HasValue ) { @Html.TextBox( "" , String.Format( "{0:yyyy-MM-dd HH:mm}" , Model.Value ) , new { @class = "textbox" , @style = "width:400px;" } ) } else { @Html.TextBox( "" , String.Format( "{0:yyyy-MM-dd HH:mm}" , DateTime.Now ) , new { @class = "textbox" , @style = "width:400px;" } ) } @{ string name = ViewData.TemplateInfo.HtmlFieldPrefix; string id = name.Replace( ".", "_" ); } <script type="text/javascript"> $(document).ready(function () { $("#@id").datepicker ({ dateFormat: 'dd/mm/yy', showStatus: true, showWeeks: true, highlightWeek: true, numberOfMonths: 1, showAnim: "scale", showOptions: { origin: ["top", "left"] } }); }); </script> ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 18.01.2012, 15:47:24 |
|
||
|
|

start [/forum/topic.php?fid=18&gotonew=1&tid=1360049]: |
0ms |
get settings: |
12ms |
get forum list: |
19ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
172ms |
get topic data: |
10ms |
get first new msg: |
5ms |
get forum data: |
2ms |
get page messages: |
33ms |
get tp. blocked users: |
1ms |
| others: | 237ms |
| total: | 499ms |

| 0 / 0 |
