i have the following situation.
I am developing a MVC 3 asp.net application. I want to make a searh form with datetime range filter. I wan to use a datepicker so the user can select the date range. I have followed this mvc tutorial
My problem is that i can not get to link the editor template to a NON MODEL @editotfor or input or @textbox, i`ll put some code so you get my point.
I have the following EditorTemplate in my Shared folder (file Date.cshtml)
@model DateTime Using Date Template @Html.TextBox("", String.Format("{0:d}", Model.ToShortDateString()), new { @class = "datefield", type = "date" })
if I use this line in my view everything works
@Html.EditorFor(m => m.fecha_Modificacion,"Date")
But i want to use the datepicker in a NON model value just a simpletextbox textbox I have been trying this :
@Html.TextBox("fechaInicio", "", new { @class = "datefield" })
But not working I´d apreciate any help
UPDATE
I must explain my problem in more detail I have a
class Foo{
private stirng name;
private DateTime dateOfBirthday;
}
In the Foo view i am editing the list.cshtml so i can searh by dateOfBirthday by from to. So i want to make two textBoxes so the user can select with a date time picker the from anf to date range. I´d like to use a template so i can re-use it. But the list.cshtml view is already typed to @Model Foo but the two textboxes are not model fields
The EditTemplate i have made work perfectly on model typed @EditorFor filds so i am trying to use on my from to date range textboxes
For what i have read i can create a EditorTemplate but that does not mean that i use everywhere i can use just where i want
Thank you very much