Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Entity framework 实体框架中的过滤列表_Entity Framework_Filter_Dotnetnuke_Records - Fatal编程技术网

Entity framework 实体框架中的过滤列表

Entity framework 实体框架中的过滤列表,entity-framework,filter,dotnetnuke,records,Entity Framework,Filter,Dotnetnuke,Records,我一直在使用dotnetnuke门户,在那里我创建了一个部门链接模块。其中,在此模块中,我有colDepartmentPageLinks,它是列表类型,并返回特定部门的链接列表,并与datalist绑定,但现在我必须根据模块id筛选colDepartmentPageLinks,模块id也是此DepartmentPageLinkInfo列表中的一个字段 DepartmentPageLinkController objDepartmentPageLinks = new DepartmentPag

我一直在使用dotnetnuke门户,在那里我创建了一个部门链接模块。其中,在此模块中,我有colDepartmentPageLinks,它是列表类型,并返回特定部门的链接列表,并与datalist绑定,但现在我必须根据模块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();
DepartmentPageLinkController objDepartmentPageLinks=newdepartmentpagelinkcontroller();
列出PartmentPageLinks;
//从DepartmentPageLink表中获取内容
int TabId=this.TabId;
int ModuleId=this.ModuleId;
colDepartmentPageLinks=objDepartmentPageLinks.GetDepartmentPageLinks(TabId);
lstContent.DataSource=colDepartmentPageLinks;
lstContent.DataBind();

您可以修改objDepartmentPageLinks.GetDepartmentPageLinks(TabId)方法,使其接受ModuleId作为参数(在相应修改GetDepartmentPageLinks方法之后),或者在数据绑定之前运行一些快速LINQ来过滤colDepartmentPageLinks列表:

//get the content from the DepartmentPageLink table
int TabId = this.TabId;
int ModuleId = this.ModuleId;
colDepartmentPageLinks = objDepartmentPageLinks.GetDepartmentPageLinks(TabId);

colDepartmentPageLinks = (From dpl In colDepartmentPageLinks Where dpl.ModuleId = intModuleId Select dpl).ToList;

lstContent.DataSource = colDepartmentPageLinks;
lstContent.DataBind();

谢谢,伙计。我更改了objDepartmentPageLinks.GetDepartmentPageLinks(TabId)方法,以便它接受ModuleId作为参数。