下拉组合没有出现在的FormCollection在控制器 [英] dropdown combo not showing up in formCollection in controller

查看:79
本文介绍了下拉组合没有出现在的FormCollection在控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的asp.net mvc的观点,我有一个选择下拉菜单:

in my asp.net mvc view i have a select dropdown:

<select id="userRole" name="userRole" disabled="true">

在我的表单提交到控制器,我有以下code:

when i submit the form to the controller, i have the following code:

    [Authorize]
    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Edit(FormCollection    formCollection_)
    {
        string role = formCollection_["userRole"].ToString();
}

但是当我直视的FormCollection对象存在的的UserRole没有钥匙。知道为什么这会是什么?

but when i look into the formCollection object there is no key for "userRole". Any idea why this would be?

推荐答案

应该只是

 <select id="userRole" name="userRole" disabled>

但禁用输入不会是你的FormCollection的一部分成功控制

这篇关于下拉组合没有出现在的FormCollection在控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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