Reputation: 73
Want to add style with onchange function in dropdownlist my code is something like this :-
@Html.DropDownListFor(m=>m.printEmployeeCardDTO.DataCardConnectionType,null,new { @onchange="_printEmployeeCard.GetPrintersDetail(this.value, printersList);" },new { style = "width: 100px;" } )
I m getting error in this. Could anyone help me in it?
Upvotes: 1
Views: 4673
Reputation: 21
Use the @
sign with the style attribute, like this:
@style = "width: 100px;"
Upvotes: 2
Reputation: 12196
You used two different parameters new { }
instead of only one separated by ,
@Html.DropDownListFor(
m => m.printEmployeeCardDTO.DataCardConnectionType,
null,
new { @onchange="_printEmployeeCard.GetPrintersDetail(this.value, printersList);", style = "width: 100px;" }
)
Upvotes: 2