表单如何带参数提交?
mvc4中使用如下方式上传文件,需要带个参数groupid,请问如何操作?
@using (Html.BeginForm("Invite", "Group", FormMethod.Post, new {enctype = "multipart/form-data",name = "inviteform",id = "inviteform"}))
------解决方案--------------------可以保存在model中啊,直接从model中获取不就可以了么,比如:
视图页面模型类为InviteModel,在其中添加Groupid 的属性:
public partial class InviteModel
{
public int Groupid { get; set; }
}
视图页面:
@model InviteModel
@using (Html.BeginForm("Invite", "Group", new { groupid = Model.Groupid }, FormMethod.Post, new { enctype = "multipart/form-data", name = "inviteform", id = "inviteform" }))