日期:2014-05-17  浏览次数:20513 次

RAZOR无法获取SELECT的值...
页面是JS添加SELECT的..然后页面生成也有值..但是选择了值,SUBMIT..CONTROLL里面确实NULL...坑爹了.求指教..
VIEW代码<script type="text/javascript">
  $(document).ready(function () {
  ....
  var obj = document.getElementById("selectone");
  var objectOption = document.createElement("option"); //创建option对象
  obj.options.add(objectOption); //把对象添加对象里面
  objectOption.innerText = strs[i - 1]; //设值
  objectOption.value = strs[i - 1];
  }

  });</script>
<p>选择姓名&nbsp; <select id="selectone" style="width:80px" ></select> &nbsp<input type="submit" value="查询" /</p>

controll里面是
  public ActionResult MOStatistics(string selectone, string mbno, int? page = 1)
  {.....

------解决方案--------------------
<select id="selectone" name="selectone"

加上name属性