Link to home
Start Free TrialLog in
Avatar of hariaspind
hariaspind

asked on

how to format date with Html.TextBoxFor helper ?

how to format date which is displayed using  Html.TextBoxFor helper  class.
Avatar of jamesbaile
jamesbaile
Flag of United Kingdom of Great Britain and Northern Ireland image

There are a number of ways you could do this.

You could create a DateTime editor template, which will mean that all dates are edited in the same way.

Have a look at the following which describes how to implement a jquery date picker.

http://elegantcode.com/2009/11/13/using-the-jquery-ui-datepicker-with-asp-net-mvc-2-templates/ 

Avatar of hariaspind
hariaspind

ASKER

I was trying to use the below syntax's.But the formatting is not working .  
 
<%= Html.TextBoxFor(model => model.ExpirationDate, String.Format("{0:MM/dd/yyyy}",
Model.ExpirationDate))%>


ASKER CERTIFIED SOLUTION
Avatar of jamesbaile
jamesbaile
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks