Reputation: 10777
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();
Upvotes: 0
Views: 582
Reputation: 2269
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:
//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();
Upvotes: 2