Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8327429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:06:24+00:00 2026-06-09T01:06:24+00:00

[EDIT: Working now. Just changed EditorFor into TextBox] I am just started with MVC3

  • 0

[EDIT: Working now. Just changed EditorFor into TextBox]

I am just started with MVC3 in C#. And I have stumbled upon this problem.

I have followed some tutorials on adding datepicker functionality to MVC3 project, but the datepicker is not showing on my web project. Here is what I have:

In my _Layout.chtml file I have included the required jQuery dependencies files :

<link href="@Url.Content("~/Content/themes/base/jquery.ui.core.css")" 
    rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/themes/base/jquery.ui.datepicker.css")" 
    rel="stylesheet"  type="text/css" />
<link href="@Url.Content("~/Content/themes/base/jquery.ui.theme.css")" 
    rel="stylesheet" type="text/css" />

<script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" 
    type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.ui.datepicker.min.js")" 
    type="text/javascript"></script>

This is what I have in my View:

@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
    <legend>Student</legend>

    <div class="editor-label">
        @Html.LabelFor(model => model.FullName)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.FullName)
        @Html.ValidationMessageFor(model => model.FullName)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.DOB)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.DOB, new { @class = "date" })
        @Html.ValidationMessageFor(model => model.DOB)
    </div>

    <p>
        <input type="submit" value="Create" />
    </p>
</fieldset>

}

and on the same file inside the View, I put the script to hook the datepicker into the editor at the top:

<script type="text/javascript">
$(document).ready(function () {
    $('.date').datepicker();
});

Many of the tutorials suggested to use the EditorTemplate for this, but I assume it is not necessary. Did I miss something? Appreciate all the helps folks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:06:26+00:00Added an answer on June 9, 2026 at 1:06 am

    I don’t believe you can use EditorFor and pass in a class. Instead, try:

    <div class="editor-field">
        @Html.TextBoxFor(model => model.DOB, new { @class = "date" })
        @Html.ValidationMessageFor(model => model.DOB)
    </div>
    

    TextBoxFor will accept HTML Attributes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I won't want to have edit any working sets. I just want a way
I had this working to spec, until the specs changed. This function is now
EDIT: I have now discovered the problem is with my WCF service getting dirty
Yesterday the application was working normally, and i didn't edit my codes. But now
EDIT: I have edited my post... Working on a project (c#), I have a
Edit: Turns out I just had some values -switched-. I'm working with OpenGL and
I have a working script like this: jQuery(document).ready(function(){ $('.video-thumb img').bind('mouseover',function(){ var new = $(this).attr('src').replace(/default.jpg/,'1.jpg');
EDIT: OK It turns out this code was working (more or less) I'd left
Edit: While my comments have an iOS 5 working example, I am still getting
I have a complicated query I've been working on, and I recently changed one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.