实体框架中的过滤器列表
我一直在与 dotnetnuke 门户合作,在那里我创建了一个部门链接模块。在这个模块中,我有 colDepartmentPageLinks,它是列表类型,并向我返回特定部门的链接列表并与数据列表绑定,但现在我必须根据模块 id 过滤 colDepartmentPageLinks,模块 id 也是此 DepartmentPageLinkInfo 列表中的一个字段。
DepartmentPageLinkController objDepartmentPageLinks = new DepartmentPageLinkController();
List<DepartmentPageLinkInfo> colDepartmentPageLinks;
//get the content from the DepartmentPageLink table
int TabId = this.TabId;
int ModuleId = this.ModuleId;
colDepartmentPageLinks = objDepartmentPageLinks.GetDepartmentPageLinks(TabId);
lstContent.DataSource = colDepartmentPageLinks;
lstContent.DataBind();
i have been working with dotnetnuke portal and there i have created a module for department links. where in this modulei have colDepartmentPageLinks which is type of List and returns me the list of links of particular departments and bind with the datalist but now i have to filter the colDepartmentPageLinks based on module id and module id is also a field in this DepartmentPageLinkInfo list.
DepartmentPageLinkController objDepartmentPageLinks = new DepartmentPageLinkController();
List<DepartmentPageLinkInfo> colDepartmentPageLinks;
//get the content from the DepartmentPageLink table
int TabId = this.TabId;
int ModuleId = this.ModuleId;
colDepartmentPageLinks = objDepartmentPageLinks.GetDepartmentPageLinks(TabId);
lstContent.DataSource = colDepartmentPageLinks;
lstContent.DataBind();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以修改您的 objDepartmentPageLinks.GetDepartmentPageLinks(TabId) 方法,以便它接受 ModuleId 作为参数(相应地修改您的 GetDepartmentPageLinks 方法之后),或者您可以运行一些快速 LINQ 来在数据绑定之前过滤 colDepartmentPageLinks 列表:
You could either modify your objDepartmentPageLinks.GetDepartmentPageLinks(TabId) method so that it accepts ModuleId as an arguement (after modifying your GetDepartmentPageLinks method accordingly) or you could run some quick LINQ to filter the colDepartmentPageLinks list just prior to databinding: