Populate (Bind) HTML DropDownList from Database in C# and VB.Net

Tevin
 
on Dec 06, 2022 01:06 AM
237 Views

Currently I am using a SELECT LIST with colors that I am hardcoding the values in.

How do i transform this so that I populate the Select List with values in my database.

<select id="colourLabel" class="form-control" name="testlist" tabindex="4">
    <option value="#CD8FFB">270 Purple</option>
    <option value="#009900">640A</option>
    <option value="#E0E033">645B</option>
    <option value="#000000">Black</option>
    <option value="#00B74F">Bright Green</option>
    <option value="#0070A5">Dark Blue</option>
    <option value="#FFB60F">Gold</option>
    <option value="#808080">Grey</option>
    <option value="#7DB5E0">J73 Low/Mid</option>
    <option value="#4F96D9">J73 High</option>
    <option value="#AF96DB">Lavendar</option>
    <option value="#008ED1">Light Blue</option>
    <option value="#8FD400">Lime Green</option>
    <option value="#FF9900">Orange</option>
    <option value="#808080">P375</option>
    <option value="#ABB0B0">P703 Low</option>
    <option value="#949C9C">P703 Mid</option>
    <option value="#97C5EB">Pale Blue</option>
    <option value="#F5A685">Peach</option>
    <option value="#E62899">Plum</option>
    <option value="#F00000">Red</option>
    <option value="#F8A4BB">Rose</option>
    <option value="#0093e1">VW240</option>
    <option value="#FFFFFF">White</option>
    <option value="#FFFF00">Yellow</option>
</select>

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download