ASP.NET MVC3 Html.EditorFor() problem

i try to bind data to model with Html.EditorFor() helper and submit, but model come to controller is null.

Here is code of model:

public class LogOnModel
    [LocalizedDisplayName("User Name")]
    public string UserName { get; set; }

    public string Password { get; set; }

    [LocalizedDisplayName("Remember Me")]
    public bool RememberMe { get; set; }

this is cshtml:

@model Models.LogOnModel
    View.Title = "Log On";
@using (Html.BeginForm())
    @Html.EditorFor(m => m.UserName);
    @Html.EditorFor(m => m.Password);
    <input type="submit" value="LogOn" />

and html code is generate like this:

<input id="UserName_UserName" name="UserName.UserName" type="text" value="qwerty" />
<input id="Password_Password" name="Password.Password" type="password" />

it seems like error in html-generated code, it should be id="someid" value="somevalue", but not id="someid_someid" value="somevalue.somevalue"


Since you're just using textboxes you could always use the following

@using (Html.BeginForm()) {
    @Html.TextBoxFor(m => m.UserName);
    @Html.PasswordFor(m => m.Password);
   <input type="submit" value="LogOn" />

Otherwise it might depend on custom templates that you've created.

Need Your Help

Audio Queue: Timestamps for recorded buffers

iphone core-audio audioqueueservices

I am trying to grab times out of recorded buffers in my AudioInputCallback function for a recording queue. Unfortunately the timestamps I'm seeing aren't as expected. Here's an example (using

How do mixed definitions work in enum?

python c ctypes

I am trying to use a C program (via dynamic libraries) with Python and the ctypes module. Several constants defined in a header file will be important for me, but I am unsure of how enum is being u...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.