@{
    string guid = Html.Guid();
}
<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">基本资料</a></li>
        @*<li class="right"><a href="javascript:void(0)" onclick="LoadData()" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a></li>*@
    </ul>
</div>
<div class="main">
    <form method="post" id="_form" class=" form  form-control-sm ui-validForm" data-validate-params="beforeSubmit:'BeforeSubmit'" data-source="@ViewBag.MemberData">
        @{
            string beforeSubmitJs = "";
            var data = new ViewDataDictionary();
            data.Add("from", "member");
            data.Add("guid", guid);
            data.Add("currentUser", ViewBag.CurrentUser);
            data.Add("i", 0);
            IEnumerable<dynamic> FieldData = ViewBag.FieldData;
            int i = 0;
            if (FieldData != null)
            {
                foreach (var row in FieldData)
                {
                    data["i"] = i;
                    beforeSubmitJs += row.BeforeSubmitJs;
                    Html.RenderPartial("~/Areas/E/Views/CustomForm/FormPartial.cshtml", (object)row, data);
                    i++;
                }
            }

        }
        <script type="text/javascript">
                function BeforeSubmit() {
                     @Html.Raw(beforeSubmitJs)
                    return true;
                }
        </script>

        <div class="postarea">
            <div class="form-group">
                <div class="controls">
                    @Html.AntiForgeryToken()
                    <input type="hidden" id="Id" name="Id" value="0" />
                    <input type="hidden" id="Guid" name="Guid" value="@guid" />
                    <input type="hidden" id="State" name="State" value="1" />
                    <input type="hidden" id="IsAdmin" name="IsAdmin" value="0" />
                    <input type="hidden" id="Logins" name="Logins" value="0" />
                    <input type="hidden" id="Password" name="Password" value="" />
                    <input type="hidden" id="MemberGroupId" name="MemberGroupId" value="0" />
                    <input type="hidden" id="DepartmentId" name="DepartmentId" value="0" />
                    <input type="hidden" name="Email" id="Email" value="">
                    <input type="hidden" name="Mobile" id="Mobile" value="">
                    <input type="hidden" id="Username" name="Username" />
                    <input type="hidden" id="_AttachmentFields" name="_AttachmentFields" value="@Html.GetAttachmentFields("pa_member")" />
                    <button type="button" class="btn btn-sm btn-primary ui-pagePost" data-custom-params="url:'@Url.ActionUrl()'">保存</button>
                </div>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    $("#_form").FormBind({ dataSourceFrom: "attr" });
</script>
