Topic: Default values in selects
egvalera free asked 5 years ago
Hi all, im programming in .NET C# Language and i wan't to display selects with a default value. It suposed to work displaying the select with the default value selected.
If i display the select without a label it works correctly, but the problem is that is doesn't work when i display the select with a label.
Works correctly (it displays the default value of ViewBag.TypeUser that is a SelectList with default value):
<select asp-for="TypeUser" asp-items="ViewBag.TypeUser" class="mdb-select md-form colorful-select dropdown-primary">
<option value="0" disabled>Select type of user</option>
</select>
Doesn't work(it doens't display the default value of ViewBag.TypeUser that is a SelectList with default value):
<select asp-for="TypeUser" asp-items="ViewBag.TypeUser" class="mdb-select md-form colorful-select dropdown-primary">
<option value="0" disabled>Select type of user</option>
</select>
<label asp-for="TypeUser" class="mdb-main-label"></label>
I tested removing the disabled option but nothing changed.
Someone who solved this?
Thanks.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Opened
- ForumUser: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.7.7
- Device: All
- Browser: Google chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: No
Bartłomiej Malanowski staff commented 5 years ago
Currently, we don't support ASP.NET