mardi 30 septembre 2014

Create and fill drop-down in JS file


Vote count:

0




I use mvc2, and I have model with data that I need to have in drop-down.


When i making drop-down in View it is not problem I use:



<%: Html.DropDownList("cbDrop", Model.Drop, "", new { @class = "dropdown" })%>


But now I need to fill drop-down in JS file.


First I try to use:



@Html.DropDownList("cbDrop", Model.Drop, "", new { @class = "dropdown" })


After I getting errors I try first to get value of model like:



var model = @Html.Raw(Json.Encode(Model))


But i get error in firebug for @ is illegal character.


Can I dynamically create drop-down in JS file and fill it with model value? Thanx



asked 1 min ago

Frink

163






Create and fill drop-down in JS file

Aucun commentaire:

Enregistrer un commentaire