1
我在表中包含此值“American | African | Asian”的字段。我想从字段中获取值并拆分文本并将其绑定到下拉列表中。我使用MVC 3创建一个htmlhelper来分割文本
到目前为止,我有这样一条:
public static SelectList SplitText(this HtmlHelper html, string texttosplit, string seperator)
{
return new SelectList(texttosplit.Split('|'));
}
但我不知道如何将它绑定在下拉列表
@Html.DropDownListFor(model => model.EM_opt1Values, @Html.SplitText(this will have an error it will not accept model => model.EM_opt1Values))
[你有什么尝试?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – Iridio
请看看更新的一个。 – user335160