Razor mvc4中动态生成@html.dropdown控件的工具提示

Razor mvc4中动态生成@html.dropdown控件的工具提示,razor,asp.net-mvc-4,Razor,Asp.net Mvc 4,我正在用Razor和C#在mvc4中进行web项目。我使用了动态显示项目的@Html.DropDownList 我想为@Html.DropDownList的每个项目设置工具提示。这是我的代码: @Html.DropDownList("Config_Industry", ViewBag.Industry as IEnumerable<SelectListItem>, "Please Choose Item", new { @class = "drpDownCustomEngin

我正在用
Razor
C#
mvc4
中进行web项目。我使用了动态显示项目的
@Html.DropDownList

我想为
@Html.DropDownList
的每个项目设置
工具提示。这是我的代码:

@Html.DropDownList("Config_Industry", ViewBag.Industry as IEnumerable<SelectListItem>, "Please Choose Item", new
{
    @class = "drpDownCustomEngineered",
    @style = "width: 258px;"                                               
})
@Html.DropDownList(“Config_Industry”,ViewBag.Industry as IEnumerable,“请选择项目”,新建
{
@class=“drpdowncustomengineering”,
@style=“宽度:258px;”
})
根据《华尔街日报》的报道,DropDownList没有这样的机会,但是

您可以使用
jQuery

<script type="text/javascript">

  $(function() {
  $("#CategoryID option").each(function() {
      $(this).attr({'title': $(this).html()});
    });
  });
</script>

$(函数(){
$(“#CategoryID选项”)。每个(函数(){
$(this.attr({'title':$(this.html()});
});
});
根据《华尔街日报》的报道,DropDownList没有这样的机会,但是

您可以使用
jQuery

<script type="text/javascript">

  $(function() {
  $("#CategoryID option").each(function() {
      $(this).attr({'title': $(this).html()});
    });
  });
</script>

$(函数(){
$(“#CategoryID选项”)。每个(函数(){
$(this.attr({'title':$(this.html()});
});
});