Tsukasa
Tsukasa

Reputation: 6552

Using Select2 in dropdownlist

Can't seem to get select2 working correctly in my view.

@Html.DropDownList(
    "ResourceID"
    , null
    , "--Select--"
    , new {@class="input-control" ,data_role="select" })

If I use select2 outside of the DropDownList then it works so I know it's not a jquery or select2 issue.

https://dotnetfiddle.net/ZH7kZR

Upvotes: 0

Views: 2283

Answers (1)

Guruprasad J Rao
Guruprasad J Rao

Reputation: 29683

Ok.. So I think you have been missing select2 css and the initialization of select2 on select element wasn't there in the fiddle you created. May be oversight. But do not forget to include proper css and js for select2.

Here is the Fiddle which is working fine and below are the cdn urls to get the file:

CSS and JS

Upvotes: 1

Related Questions