我有一个 IEnumerable
public static IEnumerable<SelectListItem> getDefaultCraft
{
get
{
List<SelectListItem> defaultCrafts = new List<SelectListItem>();
defaultCrafts.Add(new SelectListItem() { Text = "BOTTLEWATCH", Value = "1" });
defaultCrafts.Add(new SelectListItem() { Text = "CLERK", Value = "2" });
defaultCrafts.Add(new SelectListItem() { Text = "EXPEDITOR", Value = "4" });
defaultCrafts.Add(new SelectListItem() { Text = "CRANE OPERATOR", Value = "3" });
defaultCrafts.Add(new SelectListItem() { Text = "FIELD ACCOUNTANT", Value = "5" });
defaultCrafts.Add(new SelectListItem() { Text = "FOREMAN – CRANE/RIGG", Value = "6" });
defaultCrafts.Add(new SelectListItem() { Text = "WELDER", Value = "7" });
return defaultCrafts;
}
}
在一个表单上有一个下拉菜单
@Html.DropDownListFor(q1 => q1.positionAppliedFor, ORCA.Models.lookUps.getDefaultCraft)
在另一个表单上,我想显示文本。这将显示值@Html.Label("Position", cf.positionAppliedFor, new { style = "width:3in;display:inline-block" })
如何获取文本?