MVC JS动态添加 @Html.DropDownList

 

本人今天不开心,就不多说了,直接上代码啦 

灰色为错误代码红色是解决代码

var ddllist ='@Html.DropDownList("ddlList",ViewBag.ddlList as SelectList,"--请选择--")'; 

 var rows = ''+ddllist+''

 

 

 

 

 

 

 

   function Gettext() {
           var text = function() {
               var fun = function() {
                   @Html.Raw("/*")
                   @Html.DropDownList("ddlList",ViewBag.ddlList as SelectList,"--请选择--")
                   @Html.Raw("*/")
               };
           };
          text = text.toString();
          text = text.substring(text.indexOf("/*") + 3, text.lastIndexOf("*/"));
        return text;
    }

转载于:https://www.cnblogs.com/hui721/p/3765669.html

你可能感兴趣的:(MVC JS动态添加 @Html.DropDownList)