Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How i put <input type="date">, with(Model=>Model.dob)

I want somthin like......

User.Model
public date dob {get;set;}


index.cshtml

@Html.TextBoxFor(Model=>Model.dob)<input type="date">
Posted

1 solution

You can use Html.TextBox helper with an htmlAttribute.

C#
@Html.TextBoxFor(Model=>Model.dob, new { type = "date"})
 
Share this answer
 
Comments
Karmesh_Madhavi 4-Jun-15 5:52am    
what is Html.TextBox helper?
i not fount type in new{}.
Mohamed El khames Bakir 4-Jun-15 6:00am    
i mean @Html.TextBoxFor with an htmlattribute wich is a dictionary that contains the HTML attributes to set for the element like type, class, style ...
Karmesh_Madhavi 4-Jun-15 6:02am    
is type,style only in MVC5?
becoz i use MVC4 and i not found element type....!
Mohamed El khames Bakir 4-Jun-15 6:07am    
no it's a property for html input element and is not related to mvc
and you will not find it just because visual studio will not give you suggestions when you put new{} so obviously you will not find type :)
Karmesh_Madhavi 4-Jun-15 6:13am    
OK, friend, it's work,thanx...:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900