【问题标题】:Change Html control in EditorforModel MVC在 EditorforModel MVC 中更改 Html 控件
【发布时间】:2017-12-12 13:38:49
【问题描述】:

我正在为登录页面使用 EditorforModel, 这是我的模特

[Required]
    public int UserId
    {
        get; set;
    }
    [Required]
    [DataType(DataType.Password)]
    public string Password
    {
        get; set;
    }
    [HiddenInput]
    [ScaffoldColumn(false)]
    public string ReturnUrl
    {
        get; set;
    }

这是我的看法:

    @model MVCIdentityLogin.Models.LogInModel
@{
    ViewBag.Title = "LogIn";
}

<h2>LogIn</h2>


@Html.ValidationSummary(true)

@using(Html.BeginForm())
{
    @Html.EditorForModel()
    <p>
        <button type="submit"> Log In</button>
    </p>
}

我的看法是: View 此视图 Userid 输入字段具有增加和减少按钮。如何删除它? 我检查了这个 html 是

【问题讨论】:

标签: asp.net razor model-view-controller scaffold editorformodel


【解决方案1】:

只需添加这个 [DataType(DataType.Text)] Userid 属性中的属性 像这样

[Required]
[DataType(DataType.Text)]
public int UserId
{
    get; set;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-18
    • 1970-01-01
    • 2016-02-04
    • 2015-11-28
    • 1970-01-01
    相关资源
    最近更新 更多