c# - Display Returned List In Code Behind In My Dropdown List In My View -
i have list generated in code behind need pass list dropdown list in view have no idea on how new development please can me.
code behind
list<ajbg.servicecontracts.messages.thirdpartyapis.origo.getstaticcedingschemes.cedingscheme> origocedingschemes = target.getstaticcedingschemes(request).cedingschemes; list<selectlistitem> listitems = new list<selectlistitem>(); foreach (ajbg.servicecontracts.messages.thirdpartyapis.origo.getstaticcedingschemes.cedingscheme origocedingscheme in origocedingschemes) { listitems.add(new selectlistitem() { text = origocedingscheme.schemename, value = origocedingscheme.counterpartyschemeorigoid.tostring(), selected = false }); } var selectitemlist = listitems list<selectlistitem>; return selectitemlist;
view
<%=html.dropdownlist("scheme_textbox", "", new { style = "width:98%;", placeholder= "type search...", onblur="selectedscheme(this);" })%>
i have tried using viewdata
list still not displayed
use html list control "runat=server" , add data in code behind in control.
Comments
Post a Comment