在Controller里可以用FormCollection去取得View上控件的值,不过Button类型的取不到。

例子如下:

public ActionResult Allot(FormCollection _formCollection)
{

string[] str = _formCollection["functions"].ToString().Split(',');

int s = int.Parse(_formCollection["authorityid"]);

}

 

 

前台代码

<span>权限名称:@k
<input type="hidden" value="@id" name="authorityid" />
</span>
<br />
<span>功能项:</span><br />
@foreach (var item in ViewBag.functions as IEnumerable<MYJPS.Models.Function>)
{
<input type="checkbox" value="@item.FunctionID" name="functions" />@item.Name<br />
}
<input type="submit" value="确认" />

相关文章:

  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
  • 2021-08-23
猜你喜欢
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-02-20
相关资源
相似解决方案