我有一个城市列表和一个国家列表,我想将它们都放在视图(aspx)文件中。我正在尝试这样做但不起作用:
namespace World.Controllers { public class WorldController : Controller { public ActionResult Index() {
List<Country> countryList = new List<Country>();
List<City> cityList = new List<City>();
this.ViewData["CountryList"] = countryList;
this.ViewData["CityList"] = cityList;
this.ViewData["Title"] = "World Contest!";
return this.View();
This is already in Chinese.
This is already in Chinese.
This is already in Chinese.
<table>
<% foreach (Country country in this.ViewData.Model as IEnumerable) { %>
<tr>
<td><%= country.Code %></td>
</tr>
<% This is already in Chinese. %>
</table>