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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:56:52+00:00 2026-05-26T11:56:52+00:00

An article view model public class ArticleViewModel : ViewModelBase { [Required(ErrorMessage = Required)] public

  • 0

An article view model

 public class ArticleViewModel : ViewModelBase
    {

        [Required(ErrorMessage = "Required")]
        public string Title { get; set; }
        [Required(ErrorMessage = "Choose the language")]
        public BELocale Locale { get; set; }
}

public class BELocale : BEEntityBase
    {

        public string OriginalName { get; set; }
        public string FriendlyName { get; set; }
        public string TwoLetterISOName { get; set; }
    }

A view “AddLocaleForArticle”

@model Models.ArticleViewModel

@using (Html.BeginForm("VefifyAddingLocaleForArticle", "Administration"))
{

 @Html.TextBoxFor(m => m.Title, new { disabled = "disabled" })
 @Html.DropDownListFor(m => m.Locale,
                    new SelectList(ViewBag.AvalaibleLocales, "ID", "OriginalName"),   "Select a language"
               )
   @Html.ValidationMessageFor(m => m.Locale)
   <input type="submit" value="Save" />         
}

An action

public ActionResult VefifyAddingLocaleForPhoto(ArticleViewModel article)
        {
            //article.Locale == null for some reason.
             //but article.Title isn't null, it contains the data
            return RedirectToAction("AddingLocaleForPhotoSuccess", "adminka");
        }

Why article.Locale is equal null and how to 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-26T11:56:52+00:00Added an answer on May 26, 2026 at 11:56 am

    When the form is submitted a dropdown list sends only the selected value to the controller. So you cannot expect it to populate an entire complex object such as BELocale using a dropdownlist. The best you could is to populate its ID property and fetch the remaining of the object from your data store using this id.

    So you will have to modify your dropdownlist helper so that it is bound to the id property of the locale as first argument:

    @Html.DropDownListFor(
        m => m.Locale.ID,
        new SelectList(ViewBag.AvalaibleLocales, "ID", "OriginalName"),   
        "Select a language"
    )
    

    Now inside the corresponding controller action you will get the id:

    public ActionResult VefifyAddingLocaleForPhoto(ArticleViewModel article)
    {
        // article.Locale.ID will contain the selected locale id
        // so you can use this information to fetch the corresponding BELocale object
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is view models public class ArticleViewModel { public string ID { get; set;
I have article model with public ICollection<Comment> Comments { get; set; } and comment
I have a class Article: public class Article { public int Id { get;
I have this Model public class SalesModelView { [Key] public int SaleId { get;
This may be old news but back in March 2009, this article, Model-View-ViewModel In
Say I have an Article model, and in the article 'new' view I have
I have built a base class for my view model(s). Here is some of
I'm using the article Model View View-Model (MVVM) in Silverlight as a basis to
Belong to this article Jquery Partial View What should i do when i want
I've based my work on Phil Haack's article here: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx I've also looked over

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.