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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:36:21+00:00 2026-05-21T19:36:21+00:00

I am building a ASP.NET MVC 2 application and have a controller that contains

  • 0

I am building a ASP.NET MVC 2 application and have a controller that contains the following actions :

public ActionResult Edit()
{
  ...
}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(EditUser user)
{
  ...
}

To this I got a stronge typed view that looks like this :

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MasterPages/DefaultMasterPage.Master" Inherits="System.Web.Mvc.ViewPage<MyApp.Views.ViewClasses.EditUser>" %>
<%@ Import Namespace="MyApp.Views.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 <% Html.EnableClientValidation(); %>
  <% using (Html.BeginForm("Edit", "Account", FormMethod.Post, new { enctype = "multipart/form-data", @id = "edit_account" }))
   {%>
     <%: Html.LabelFor(model => model.User.UserEmail, false) %>
     <%: Html.TextBoxFor(model => model.User.UserEmail, new { @class = "tb1" })%>
     ...
<% } %>
</asp:Content>

When hitting the submit button(not shown in code) the public ActionResult Edit(EditUser user) action will be hit but the user object will not contain any data?

This is how part of the html look like :

<div class="controlTitleContainer"><div class="text"><label for="User_UserEmail">Mailadress</label></div></div>
<input type="text" value="" name="User.UserEmail" id="User_UserEmail" class="tb1">

This should mean that the input is pointed to the correct property.

Worth mentioning is that I use Data annotation to validate the object sent to the action but the model is always valid even when having a couple of requre fields.

Any idé why this is happening?

  • 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-21T19:36:22+00:00Added an answer on May 21, 2026 at 7:36 pm

    You haven’t shown your model but make sure that it contains public properties with getters and setters and default parameterless constructors. Example:

    public class EditUser
    {
        public UserModel User { get; set; }
    }
    
    public class UserModel
    {
        [Required]
        public string UserEmail { get; set; }
    }
    

    Finally try renaming the action argument to something else other than user (just to test):

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Edit(EditUser u)
    {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building an ASP.NET MVC application with a form that needs validation. The majority
I am building a ASP.NET MVC application where I use the following flow :
I'm looking into building an ASP.NET MVC application that exposes (other than the usual
I am building a multi-layered application that has an ASP.NET MVC web application. It
I'm building my first ASP.NET MVC application and I am having some troubles with
I'm am building my asp.net web application using MVC (Preview 5), and am also
I am currently building an application using ASP.NET MVC. The data entry pages are
I'm building an ASP.Net MVC website. Rather than have everything in one project, I've
I am building an Asp.net MVC site where I have a fast dedicated server
I am building my first ASP.Net MVC based app and have a problem accessing

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.