- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我构建了一个有 4 层的解决方案
1-One 解决方案(数据访问层)具有来自不同数据库的多个 (DAL)。
2-数据存储(访问所有 DAL)。
3-业务层BL(haslogicmethods)
4-表示层 (MVC4)。
问题是我想通过BLL使用Para Name调用DAL(Establishment)中的列表搜索方法来搜索它,并希望在PL中的View中显示结果。EstController
public ActionResult Index(string Name)
{
if (Name != null)
{
IList list = BLL.Establishment_Serv.getEstablishmentByName(Name.ToUpper());
return View(list);
}
return View();
}
和预估/指数 View
@using (Html.BeginForm("Index" ,"Est",FormMethod.Get))
{
<p>
Find by name: @Html.TextBox("Name")
<input type="submit" value="Search" />
</p>
}
<table>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.Id)</td>
<td>@Html.DisplayFor(modleItem => item.Name)</td>
</tr>
}
</table>
我在 foreach 语句中遇到错误。如果有最好的方法,请提示我。
最佳答案
您是否将其放入您的 View 中:
@model IEnumerable<YourModel>
关于asp.net-mvc - foreach 语句无法运行,因为不包含 'GetEnumerator' 的公共(public)定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22930576/
在 .net 框架中,有一个通用的 IEnumerable继承自非泛型 IEnumerable 的接口(interface),并且他们都有 GetEnumerator()方法。这两者之间的唯一区别Ge
致力于实现 IEnumerable 接口(interface)。我实际上找到了两个需要实现的方法: public IEnumerator GetEnumerator() System.Collecti
查看这段代码: public class myWords : IEnumerable { string[] f = "I love you".Split(new string[]{"lo"},
基本上假设您有一些收藏: public class FurCollection : IEnumerable { public IEnumerator GetEnumerator() {
List为什么要定义这三个方法? public Enumerator GetEnumerator() => new Enumerator(this); IEnumera
我对 Reflection.Emit 有疑问。我想要动态创建的类,它具有 ICollection 的简单实现。我定义的所有方法都很好,而不是接下来的两个: public IEnumerator Get
来自 SortedSet.GetEnumerator 文档: This method is an O(1) operation 来自 SortedDictionary.GetEnumerator 文档
我正在编写一个应该能够显示任何数据列表的控件。我想要做的是模仿 for-in 构造,因为我检查包含 Current 属性和 MoveNext 方法的公共(public) GetEnumerator 函
我正在使用 JSOM 查找特定列表中特定项目的特定字段中的值。总的来说,代码查找用户的组成员身份(使用 SPServices),然后使用该值来匹配列表中的项目(列表包含填充有组名称的“Title”字段
我不能重载 GetEnumerator () 吗 IEnumerator IEnumerable.GetEnumerator ( T[] val1,T[] val2) { .... some co
我正在为 C# 开发并发字典实现,我想知道这个 GetEnumerator() 实现是否实际上是(线程)安全的。 它并没有做一个实际的快照,所以我想知道它是否会在以后读/写内部字典时搞砸,或者它是否会
我有一个 BinaryTree类和一个BinaryTreeNode对于持有节点,我已经制作了树并为它编写了前序、后序和中序方法。 但我不知道怎么写IEnumerator为此(我只想对 GetEnume
假设我有一个非常 长的字符串,并且想要获取一个从字符串中间的给定索引处开始的枚举器(为了 LINQ 的优点)。也就是说, var longString = GetLongString(); var i
我想将枚举器用于 Delphi XE2 的通用集合。我想知道,谁拥有函数 GetEnumerator 返回的 TEnumerator (我在文档中没有找到任何明确的答案): 我是否拥有它并需要在使用后
在我们的代码库中,我们有一个数据访问层,提供类似于以下的方法: public IEnumerable GetFoos() { var collection = new Collection()
我真的不明白为什么在这个例子中,这个类定义了两个GetEnumerator方法:一个显式实现接口(interface),另一个隐式 如我所知。那为什么? class FormattedAddresse
我有一个简单的代码,目的是在文件不存在或其中的数据版本已过时时通过文件或数据库返回枚举器。简单的。但是,我正在为该方法的工作原理而苦苦挣扎。原因如下: public override IEnumera
我尝试在 SharePoint 中接收用户子网站的子网站。在第一次调用接收子网站(函数 getSubWebs())时,一切正常:子网站已接收,我可以遍历它们。 但是当我尝试使用相同类型的代码获取这些网
我想在哈希集上使用 foreach,但 VS 不允许。 这是我到目前为止所拥有的: { class Team { private HashSet team; public Team()
我想遍历更新面板的各种控件。在使用控件 ID 进行迭代时,我想删除一些控件。 但我不知道如何使用 GetEnumerator 方法遍历更新面板的控件? 如果我们可以通过其他方式进行迭代,请告诉我。 最
我是一名优秀的程序员,十分优秀!