asp.net mvc - why DropDown() helper method does not display the dropdown when it was used in a C# block? -
i have following view code generate drop down list control.when code written in c# block not display drop down
here code
@{ viewbag.title = "index"; html.dropdownlist("id", model.catcoll); } but when write outside of c# block displays.. why happens , how fix this?
whatever inside @{ } should c# code, whatever outside of it, should asp.net code.
if want combine 2 in order display c# values inside html, can use following style: @someproperty
example:
<h1>@viewbag.title</h1> fix problem, put dropdownlist outside:
@html.dropdownlist("id", model.catcoll);
Comments
Post a Comment