gpt4 book ai didi

.net - ASP.NET MVC 3 中的下拉列表

转载 作者:行者123 更新时间:2023-12-02 18:04:10 25 4
gpt4 key购买 nike

<div class="editor-label">
@Html.LabelFor(model => model.Category)
</div>
<div class="editor-field">

@Html.EditorFor(model => model.Category)
@Html.ValidationMessageFor(model => model.Category)
</div>

这给了我一个标签和一个文本框。如何获得带有静态选择项的下拉列表来代替文本框。请帮忙。我是 ASP.NET MVC 新手。我需要 Razor 语法的解决方案/建议。

最佳答案

@Html.DropDownListFor( model => model.Category, new SelectList(new [] {"cat1", "cat2", "cat3"}) );

关于.net - ASP.NET MVC 3 中的下拉列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6232222/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com