Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Populate dropdownlist by ViewBag in Javascript

$
0
0

Hello 

I have Select (dropdown list)  which I can fill it using ViewBag, 

I used javascript to create dynamic table using append as follow 

$('#Table').append('<tr><td class="id"><input type="text" class="form-control" id=id"/></td></tr> ')



When I add Select into the same above line, It will create empty select without populating any data from the controller, my syntax as follow: 

$('#Table').append('<tr><td><select id="SelectDetails"  asp-items="@ViewBag.SelectDetails"></select></td></tr>')



any idea? 

Thanks 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>