Ankit Singh
Ankit Singh

Reputation: 31

tooltip for dynamically generated @html.dropdown control in mvc4

I'm working on web project in MVC 4 with Razor and C#. I have used @Html.DropDownList that display items dynamically.

I want to set ToolTip for every item of @Html.DropDownList. This is my code:

@Html.DropDownList("Config_Industry", ViewBag.Industry as IEnumerable<SelectListItem>, "Please Choose Item", new
{
    @class = "drpDownCustomEngineered",
    @style = "width: 258px;"                                               
})

Upvotes: 1

Views: 1660

Answers (1)

MikroDel
MikroDel

Reputation: 6735

According to this there is no such an opportunity for DropDownList, but

you can use jQuery:

<script type="text/javascript">

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

Upvotes: 1

Related Questions