2017-07-08 43 views
-1

我想補充兩個我怎麼可以添加多個屬性hellper在@using類在我的代碼

{ 
    enctype = "multipart/form-data" 
} 

{ 
    id = "frmRegister", 
    onsubmit = "viewManager.postFormByAjax({ targetBodyId: '#SR_Signup', formId: 'frmRegister' }); return false;" 
} 

代碼下來,但它給了我一個錯誤怎麼辦這

@using (Html.BeginForm("SignUp", "Users", FormMethod.Post, new { enctype = "multipart/form-data" }@*{ id = "frmRegister", onsubmit = "viewManager.postFormByAjax({ targetBodyId: '#SR_Signup', formId: 'frmRegister' }); return false;"}*@)) 
{ 
    <div> 
     @ViewBag.Message 
     @Html.ShowResultsFromVC((SRCore.DTO.ResultsContainer) ViewBag.Message) 
     @Html.AntiForgeryToken() 
    </div> 


    <div class="form-group"> 
     <label for="FirstName">FirstName</label> 
     <input type="text" class="form-control" placeholder="Enter Your First Name" id="FirstName" name="FirstName" required="required" value="@Model.FirstName"> 
    </div> 
    <div class="form-group"> 
     <label for="LastName">LastName</label> 
     <input type="text" class="form-control" placeholder="Enter Your Last Name" id="LastName" name="LastName" required="required" value="@Model.LastName"> 
    </div> 
    <div class=form-group> 
     <label for="email">Email</label> 
     <input type="email" class="form-control" placeholder="Enter Your Email Address" id="Email" name="Email" required="required" value="@Model.Email"> 
    </div> 

    <div class=form-group> 
     <label>Phone</label> 
     <input type="text" class="form-control" placeholder="Enter Your Phone Number" id="PhoneNumber" name="PhoneNumber" value="@Model.PhoneNumber"> 
    </div> 

     @*<div class=form-group> 
    <label>Gender</label> 
    <div class="radio"><input type="radio" value="Male" id="Gender" checked name="Gender"> <span>Male</span> <input type="radio" value="Female" name="gender"> <span>Female</span> 
    </div> 
     </div>*@ 


    <div class=form-group> 
     <label>Gender</label> 
     <label class="radio-inline"><input type="radio" id="Gender" value="Male" checked name="Gender">Male</label> 
     <label class="radio-inline"><input type="radio" value="Female" name="gender">Female</label> 
    </div> 

    <div class="input-group"> 
     <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span> 
     <input id="UserName" type="text" class="form-control" name="UserName" placeholder="UserName" value="@Model.UserName"> 
    </div> 
    <br/> 

    <div class="input-group"> 
     <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span> 
     <input id="Password" type="password" class="form-control" name="Password" placeholder="Password" value="@Model.Password"> 
    </div> 
    <br/> 

    <div class="input-group"> 
     <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span> 
     <input id="ConfirmPassword" type="password" class="form-control" name="ConfirmPassword" placeholder="Confirm Password" value="@Model.ConfirmPassword"> 
    </div> 
    <br/> 

    <div class="input-group"> 
     <span class="input-group-addon">Text</span> 
     <input id="AdditionalText" type="text" class="form-control" name="AdditionalText" placeholder="Additional Info" value="@Model.AdditionalText"><br/> 
    </div> 
    <br/> 

    <div class=form-group> 
     <label>Date of Birth</label> 
     <input type="date" name="DOB" id="DOB" class="form-control" style="width: 100%; border-radius: 2px;"> 
    </div> 





    <div class=form-group> 
     <label>Profile Pic </label> 
     <input type="file" class="btn btn-default" value="Upload Your Profile Pic" name="file" id="file"/> 
     <input type="submit" class="btn btn-default" value="Ok"/> 
    </div> 


     @*<div class=form-group> 
    <label>Captcha</label> 
    <input type="text" class="form-control" placeholder="Enter Code" id="captcha" name="captcha" class="inputcaptcha" required="required"> 
    <img src="demo_captcha.php" class="imgcaptcha" alt=""/> 
    <img src="images/refresh.png" alt="reload" class="refresh"/> 
     </div>*@ 



    <div class=form-group> 
     <label>&nbsp;</label> 
     <div class="otherinputs"> &nbsp; &nbsp;<input type="reset" class="btn btn-default" value="Reset" name="B2"> 
     </div> 
    </div> 
}} 

回答

0

爲什麼不使用所有的屬性如下

@using (Html.BeginForm("SignUp", "Users", FormMethod.Post, 
new { enctype = "multipart/form-data", 
     id = "frmRegister", 
     onsubmit = "viewManager.postFormByAjax({ targetBodyId: '#SR_Signup', formId: 'frmRegister' }); return false;" 
    })) 
    { 


    } 
+0

我試過這種方法,但它沒有工作 –

相關問題