ASP.NET MVC ListBox - Width

auto
  • Zimbabwe230
  • Zambia229
  • Yemen228
  • Wallis and Futuna227
  • Wales226
  • Virgin Islands225
  • Vietnam224
  • Venezuela223
  • Vatican City222
  • Vanuatu221
  • Uzbekistan220
  • USA219
  • Uruquay218
  • United Arab Emirates217
  • Ukraine216


Width="250"
  • Zimbabwe230
  • Zambia229
  • Yemen228
  • Wallis and Futuna227
  • Wales226
  • Virgin Islands225
  • Vietnam224
  • Venezuela223
  • Vatican City222
  • Vanuatu221
  • Uzbekistan220
  • USA219
  • Uruquay218
  • United Arab Emirates217
  • Ukraine216


Width="25%"
  • Zimbabwe230
  • Zambia229
  • Yemen228
  • Wallis and Futuna227
  • Wales226
  • Virgin Islands225
  • Vietnam224
  • Venezuela223
  • Vatican City222
  • Vanuatu221
  • Uzbekistan220
  • USA219
  • Uruquay218
  • United Arab Emirates217
  • Ukraine216


Width="75%"
  • Zimbabwe230
  • Zambia229
  • Yemen228
  • Wallis and Futuna227
  • Wales226
  • Virgin Islands225
  • Vietnam224
  • Venezuela223
  • Vatican City222
  • Vanuatu221
  • Uzbekistan220
  • USA219
  • Uruquay218
  • United Arab Emirates217
  • Ukraine216

The Width property is used to control the width of the ListBox. If the property is not set, a default width of 150px will be used.
View - Aspx

    <% Html.Obout(new ListBox("ListBox1")
    {   
        Width = 250
    }); %> 

    <% Html.Obout(new ListBox("ListBox2")
    {   
        Width = Unit.Percentage(25)
    }); %> 
    
    
View - Razor

    @Html.Obout(new ListBox("ListBox1")
    {   
        Width = 250
    })

    @Html.Obout(new ListBox("ListBox2")
    {   
        Width = Unit.Percentage(25)
    })