c# - Retrieve data from database column in WebMatrix -
im using webmatrix 2. need retrieve data column in database. database column:
i have used code retrieve data , in combobox
@{ var db1 = database.open("startersite"); var selectcommand = "select motivo set_residenziali"; var selecteddata = db1.query(selectcommand); } <select name="motivo"> @foreach(var row in selecteddata) { <option value="@row.motivo">@row.motivo</option> } </select>
with code result:
but need obtain result:
i tried many solutions, without success. in advance!
you need split value:
<select name="motivo"> @foreach(var row in selecteddata){ foreach(var item in row.motivo.tostring().split(new [] {','})){ <option>@item</option> } } </select>
Comments
Post a Comment