tags:

views:

55

answers:

1

I have a typical ADO.NET EF-driven form that allows the user to input a date. I have put a jQuery datepicker on it but when the user goes to select a date the browser shows some other entries in a dropdown. How do I turn off that dropdown? In traditional ASP.NET I would put autocomplete="off". Not sure of the MVC equivalent.

 <div class="editor-field">
            <%= Html.TextBoxFor(model => model.date, new { @class = "aDatePicker" })%>
            <%= Html.ValidationMessageFor(model => model.date) %>
        </div> 
+2  A: 

Try this:

<%= Html.TextBoxFor(
    model => model.date, 
    new { @class = "aDatePicker", autocomplete = "off" }
)%>

It will generate markup that is close to the following:

<input type="text" id="date" name="date" class="aDatePicker" autocomplete="off" />
Darin Dimitrov