![](/img/trans.png)
[英]How do I format a DateTime to be displayed as simply the time of day in a Razor-generated view?
[英]How to Create a List<TSource> for Razor-generated .cshtml files
關於我的上一個問題 ,我想在我的.cshtml文件中設置返回的List<Class1> listClass
。 但是,由於無法識別Class1類,因此無法在.cshtml文件中創建以下代碼:
@ {
List<Class1> listClass = new List<Class1>();
}
<html>
<!-- code for the view goes here -->
</html>
Class1和.cshtml文件位於不同的命名空間中。 任何幫助將不勝感激。
在@using
語句中添加您的Class1所在的名稱空間
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.