c# - Retrieve data from database column in WebMatrix -


im using webmatrix 2. need retrieve data column in database. database column:

enter image description here

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:

enter image description here

but need obtain result:

enter image description here

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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -