我有这个:
<% if (ViewData["roots"] != null) {%>
<%Html.DropDownList("roots"); %>
<%}%>
Run Code Online (Sandbox Code Playgroud)
但这不起作用。如何查看ViewData是否存在?
您没有输出任何内容并且错误地使用了 DropDownList 帮助程序。像这样尝试:
<% if (ViewData["roots"] != null) { %>
<%= Html.DropDownList("roots") %>
<% } %>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14003 次 |
| 最近记录: |