Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataType.Date
Message
 
 
À
30/08/2012 11:53:35
Information générale
Forum:
ASP.NET
Catégorie:
MVC
Titre:
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01551951
Message ID:
01552020
Vues:
34
>For the editor for your Dates, add a UIHint:
>
[UIHint("MyDateTimeTemplate")]
>
>Then create an editor template for it with the same name. For example:
>
@model DateTime?
>
>@Html.TextBox("", (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty)) 
>< script type="text/javascript">
>	$("#@ViewData.ModelMetadata.PropertyName").datepicker({ dateFormat: 'mm/dd/yy' });
>< /script>
>
>As for defining a new class for the dropdown, I believe that is unnecessary. Providing the display field name and value field name should be enough to only include those in the resulting html.

Rob,

How should I create the editor template (in which folder)? How MVC framework will associate Date type with that template?

Thanks again.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform