public static MvcHtmlString DropDownForSLotAuthItem <TModel, TValue>(this HtmlHelper <TModel> html, Expression <Func <TModel, TValue> > expression, object htmlAttributes = null) { string id = Html.NameExtensions.IdFor(html, expression).ToString(); string idForFunctionName = id.Replace('-', '_'); //注意 string value = Html.ValueExtensions.ValueFor(html, expression).ToString(); List <CommonType> commonTypes = JsonType.GetSlotAuthTypes(); //CurrencyType 下拉選單 List <SelectListItem> sLotAuthItems = new List <SelectListItem>(); foreach (var commonType in commonTypes) { sLotAuthItems.Add(new SelectListItem() { Text = commonType.Text, Value = commonType.Value, Selected = (commonType.Value == value) }); } MvcHtmlString result = Html.SelectExtensions.DropDownListFor(html, expression, sLotAuthItems, new { @class = "form-control" }); return(MvcHtmlString.Create(result.ToString())); }
public ActionResult Login() { var x = Server.MapPath("/"); var xxx = JsonType.GetSlotAuthTypes(); AccountLoginView vm = new AccountLoginView(); vm.Account = "superadmin"; vm.Password = "******"; return(View(vm)); }