Tuesday, 5 January 2021

MVC - Modify Drop Down List width

 

 Watch this example on YouTube


 

 

1. View

@using (Html.BeginForm("Index", "Home"))
{
    @Html.DropDownListFor(x=>x.or.ProductID, new SelectList(Model.prod,"ProductID", "Name"), new { @id = "myID" })
}
 

 

2. CSS

#myID{
    width:2em;
}

No comments:

Post a Comment