0
我是新的MVC和我坚持这个问题我有一个ViewUserControl与一个小的联系表单,我已经创建了这个ContactForm的模式。ASP.NET MVC DropDownList里面ViewUserControl
[Required(ErrorMessage = "Type your Name"), DataType(DataType.Text)]
[DisplayName("Name")]
public string NameProperty { get; set; }
[Required(ErrorMessage = "Type your Mobile"), DataType(DataType.Text)]
[DisplayName("Mobile")]
public string MobileProperty { get; set; }
[Required(ErrorMessage = "Type your City"), DataType(DataType.Text)]
[DisplayName("City")]
public string CityProperty { get; set; }
[Required(ErrorMessage = "Select Product"), DataType(DataType.Text)]
[DisplayName("Product")]
public IEnumerable<SelectListItem> ProductProperty { get; set; }
[Required(ErrorMessage = "Type your Message"), DataType(DataType.MultilineText)]
[DisplayName("Message")]
public string MessageProduct { get; set; }
public static IEnumerable<SelectListItem> ProductList()
{
List<SelectListItem> items = new List<SelectListItem>();
items.Add(new SelectListItem { Text = "Printed Fabrics", Value = "1" });
items.Add(new SelectListItem { Text = "Silk Fabrics", Value = "2" });
items.Add(new SelectListItem { Text = "Printed Silk Fabrics", Value = "3" });
return items;
}
内ViewUserControl
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<govindHari.Models.ContactForm>" %>
现在如何调用这里面
<%= Html.LabelFor(m => m.CityProperty) %>
<%= Html.TextBoxFor(m => m.CityProperty, new { @class = "textBox" })%>
<%= Html.LabelFor(m => m.MobileProperty) %>
<%= Html.TextBoxFor(m => m.MobileProperty, new { @class = "textBox" })%>
<%= Html.LabelFor(m => m.ProductProperty) %>
<%= Html.DropDownListFor(m => m.ProductProperty)%>
的问题是它不是为我工作,即使我从HomeController的把它从索引页
请给我帮助
它怎么不工作? – 2011-12-15 20:48:17