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 6834565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:07:38+00:00 2026-05-26T23:07:38+00:00

@Html.DropDownList( CreatedByUser_ID, new SelectList( Model.GetUsers(), ID, Name, (int)Model.CreatedByUser_ID), select one user—-) CreatedByUser_ID property on

  • 0
@Html.DropDownList(
   "CreatedByUser_ID",
   new SelectList(
          Model.GetUsers(), 
          "ID", 
          "Name", 
          (int)Model.CreatedByUser_ID),
   "select one user----") 

CreatedByUser_ID property on model has no Required attribute, but on client side the generated select box is validated. If I remove optionLabel (select one user—-) then validation is turned off.

Why mvc3 automatically validate my dropdownbox without required field ?

Thank you

  • 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-26T23:07:38+00:00Added an answer on May 26, 2026 at 11:07 pm

    I guess if your model property CreatedByUser_ID is an int, the HTML rendered by the helper will not specify a value attribute for the “select one user” option. You can’t give an int a null value, so the validation kicks in.

    Surely you would want the user to select an option? If not, try making your CreatedByUser_ID a nullable int – int? in C#.

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

Sidebar

Related Questions

@this.Model.ActiveApplicationId @this.Html.DropDownList(applications, new SelectList(this.Model.AllApplications, ApplicationId, Title, this.Model.ActiveApplicationId)) renders... 17 <select id=applications> <option value=16>app 16</option>
As the title says really <td><%= Html.DropDownList(Weight, Model.Weightddl.Select(x => new SelectListItem { Text =
I have a @htmlDropDownList as @Html.DropDownList(MyList, new SelectList(Model.List, Id, Movie)) in a mvc3 view.
I have follwoing code @Html.DropDownList(optionsforuser, new SelectList(new[] { Option1, Option2 }), Select) Now i
I have follwoing code @Html.DropDownList(optionsforuser, new SelectList(new[] { Option1, Option2, Option3 }), Select) Is
I've got the following in my view: <%= Html.DropDownList(Schema.MetaData.SourceTableName, new SelectList(Model.Schema.MetaData.SourceTableNames, Model.Schema.MetaData.SourceTableName), Model.SourceTablesOptionLabel)%> SourceTableNames
i have a dropdownlist, in mvc 3 razor: @Html.DropDownList( SelectedLicensesID, new SelectList(Model, LicensesID, LicenseUI))
In my view there is this DropDownList : @Html.DropDownList(fOrderstatus, TryCast( ViewBag.StatusOptions, SelectList), --pick--, New
I have the following code- View- <% Html.BeginForm(); %> <div> <%= Html.DropDownList(DropDownSelectList, new SelectList(
I am wondering why the following code: @Html.DropDownList(Classification.Nationality.NationalityId, Model.Nationalities, new { @size = 10,

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.