0
我對.NET相當新,我想讓mt頭部纏繞一些簡單的表單和驗證語法的東西。使用剃鬚刀的網頁表單MVC概念
我有一個看起來像這樣
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Presentation.Web.Models.FormModels
{
public class ContactUs
{
public String name { get; set; }
public String email { get; set; }
public String comment { get; set; }
}
}
模型ContactUs.cs我的剃鬚刀看起來像這樣
@using(Html.BeginForm()){
<div class='form-group'>
<div class='row'>
<div class='col-md-3'>
<label class='control-label'>Your Name</label>
<input class='form-control' placeholder='your username' type='text'>
</div>
<div class='col-md-3'>
<label class='control-label'>Your Email</label>
<input class='form-control' placeholder='your password' type='text'>
</div>
</div>
</div>
<div class='form-group'>
<div class='row'>
<div class='col-md-6'>
<label class='control-label'>Your Message</label>
<textarea class='form-control' name='' rows='4'></textarea>
</div>
</div>
</div>
}
<input type="button" ID="sumbmit-contact-us" runat="server" name="Save" value="SUMBMIT"/>
我在努力弄清楚如何動態地打印標籤和驗證做檢查提交。另外,如果我最終將此添加到HomeController.cs中,那麼該語法應該如何?
@ Dai--我其實下面這個帖子 http://ryanbutler.org/ASPMVCForm 會你不推薦這個? – soum