从下拉列表中获取价值 [英] Getting Value from a dropdownlist

查看:91
本文介绍了从下拉列表中获取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的代码如下:



I wrote the code like:

div class="editor-label">
    @Html.LabelFor(model => model.Designation)
</div>
<div class="editor-field">
   @Html.DropDownList("CategoryID")
     @Html.ValidationMessageFor(model => model.Designation)
</div>





但是当我点击A s时ubmit按钮保存数据库中的值,它不会将任何内容传递给控制器​​。



请你帮我传递标签的值??



But When I click A submit Button to save the value in database it doesn't pass anything to the controller.

Would you please help me to pass the value for the the label ??

推荐答案

参见< a href =http://www.itorian.com/2013/05/three-ways-to-populate-selected-value.html>这里 [ ^ ]


在LabelFor的地方使用displayFor



请检查并确认。
use displayFor at place of LabelFor

PLease check and confirm.


这篇关于从下拉列表中获取价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆