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

  • SEARCH
  • Home
  • 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 6218557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:37:52+00:00 2026-05-24T07:37:52+00:00

I have this part in asp.net MVC 3 view: <tr> <td>@Html.LabelFor(x => x.DateOfBirth, new

  • 0

I have this part in asp.net MVC 3 view:

   <tr>
         <td>@Html.LabelFor(x => x.DateOfBirth, new { @class = "lbl" }, "Date Of Birth") </td>
        <td>@Html.TextBoxFor(x => x.DateOfBirth, new { @class = "w100 _dob" })
        <br>@Html.ValidationMessageFor(x => x.DateOfBirth)       
        </td>
    </tr> 

but in controller action DateOfBirth is set to Datetime.minimum value

   public ActionResult Index(IdentifyModel identifyModel) {}

VIEW CODE

@model CreditRegistry.Models.Helpers.IdentifyModel

@{
    ViewBag.Title = "Identify";
    ViewBag.BreadCrumb = "Identify";
}
@section BodyTitle {
    <span>Identify</span> yourself
}
<ul class="extra">
    <li><a href="#">Receive Free Credit Report</a></li>
    <li><a href="#">Premium Subscription</a></li>
    <li><a href="#">FAQ</a></li>
</ul>


@using (Html.BeginForm("Index","Identify",FormMethod.Post,new{autocomplete="off", id="frmIdentify"})) {


<p class="info">
    View and print your credit report after you authenticate your identity. <u><b>Your first
        credit report is free.</b></u>
</p>


    <p>
    Please provide as much information as you can so we can identify who you are.
    Refer to the <b>@Html.ActionLink("FAQ", "FAQ", "Home")</b> for help.
    </p>

 @*   
<p>
    Is this report for an @Html.RadioButton("_mode", "_individualFields", true, new { @class = "_mode" })
    Individual or a @Html.RadioButton("_mode", "_businessFields", new { @class = "_mode" })
    Business?
</p>
*@


    @Html.ValidationSummary()

<fieldset class="form">
<table>
    <tr>
        <td>@Html.LabelFor(x => x.FirstName, new { @class = "lbl" }, "First Name")</td>
        <td>@Html.TextBoxFor(x => x.FirstName, new { @class = "w200" })
            <br>@Html.ValidationMessageFor(x => x.FirstName)
        </td>
    </tr>
    <tr>
        <td>@Html.LabelFor(x => x.LastName, new { @class = "lbl" }, "Last Name")</td>
        <td>@Html.TextBoxFor(x => x.LastName, new { @class = "w200" })
        <br>@Html.ValidationMessageFor(x => x.LastName)
        </td>
    </tr>
     <tr>
         <td>@Html.LabelFor(x => x.DateOfBirth, new { @class = "lbl" }, "Date Of Birth") </td>
        <td>@Html.TextBoxFor(x => x.DateOfBirth, new { @class = "w100 _dob" })
        <br>@Html.ValidationMessageFor(x => x.DateOfBirth)       
        </td>
    </tr> 

    <tr>
        <td>(optional)@Html.LabelFor(x => x.Phone, new { @class = "lbl" }, "Mobile Number") </td>
        <td>@Html.TextBoxFor(x => x.Phone, new { @class = "w200" })
        <br>@Html.ValidationMessageFor(x => x.Phone)
        </td>
    </tr>


    <tr>
        <td>(optional)@Html.LabelFor(x => x.DLNumber, new { @class = "lbl" }, "Driver's License Number") </td>
        <td>@Html.TextBoxFor(x => x.DLNumber, new { @class = "w200" })
        <br>@Html.ValidationMessageFor(x => x.DLNumber)
        </td>
    </tr>
    <tr>
        <td>(optional)@Html.LabelFor(x => x.PassportNo, new { @class = "lbl" }, "Passport Number") </td>
        <td>@Html.TextBoxFor(x => x.PassportNo, new { @class = "w200" })
        <br>@Html.ValidationMessageFor(x => x.PassportNo)
        </td>
    </tr>
    <tr>
        <td>(optional)@Html.LabelFor(x => x.NationalID, new { @class = "lbl" }, "National ID") </td>
        <td>@Html.TextBoxFor(x => x.NationalID, new { @class = "w200" })
        <br>@Html.ValidationMessageFor(x => x.NationalID)
        </td>
    </tr>
</table> 
    <p>
        <label>
        </label>
        <input type="submit" value="Start Identification" />
    </p>
</fieldset>

}

<script type="text/javascript">
    $(function () {
        $('#frmIdentify').attr('autocomplete', 'off'); @*make sure autocomplete off for browsers that already stored some information*@
        $('._dob').datepicker({ dateFormat: "yy-mm-dd", changeMoth: true, changeYear: true, yearRange: '-100y:c+nn' });
    });

How can I fix it

  • 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-05-24T07:37:54+00:00Added an answer on May 24, 2026 at 7:37 am

    You need to have DateOfBirth as a DateTime? datatype; a Nullable DateTime. This means that if DateOfBirth has no value, then it will be NULL, rather then DateTime.MinValue.

    public class IdentifyModel  {
       public DateTime? DateOfBirth {get;set;}
    }
    

    EDIT:

    I just replciated your issue and found a fix.

    In your viewmodel class IdentifyModel you must declare DateOfBirth as a nullable DateTime:

    public DateTime? DateOfBirth { get; set; }
    

    Doing this stops the view from showing 01/01/0001 (or whatever the default date is) when you GET the view.

    Then, when I entered “1/2/2010” into the textbox and posted the form, the DateTime value “1/2/2010” was posted back into the viewmodel.

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

Sidebar

Related Questions

i have an html table in my asp.net mvc view an i am running
I've been fiddling with asp.net mvc 3 with the new razor view engine. My
i have to create a new asp.net mvc page that integrates content provided by
I am using Razor view engine in ASP.Net MVC 3 RC 2. This is
I have one asp.net mvc 3 application. public ActionResult Students() { return View(); }
I have an asp.net mvc application where I want to hide/display part of form
I have one asp.net page. I want to add this page to asp.net mvc
In ASP.Net MVC 3 I have a Controller and View with a portion of
I have asp.net mvc application, that uses razor view engine. I want to send
I am trying to learn ASP.NET MVC and I hit this problem: I have

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.