Telerik Sitefinity - Sorting data selected -
i has code below retrieve data
type dtype = typeresolutionservice.resolvetype("telerik.sitefinity.dynamictypes.model.schedule.schedulemanagement"); // how collection of event items var mycollection = dynamicmodulemanager.getdataitems(dtype).where(i => i.status == contentlifecyclestatus.live && i.visible && i.getvalue<string>("title").tostring() == channel + " schedule").firstordefault(); // @ point mycollection contains items the type return mycollection;
any idea how can sorting data been selected? please help.
firstly need remove .firstordefault() returns single item (or null) not collection.
to sorting in linq need use .orderby()
eg, order title.
type dtype = typeresolutionservice.resolvetype("telerik.sitefinity.dynamictypes.model.schedule.schedulemanagement"); // how collection of event items var mycollection = dynamicmodulemanager.getdataitems(dtype).where(i => i.status == contentlifecyclestatus.live && i.visible && i.getvalue<string>("title").tostring() == channel + " schedule").orderby(p=> p.getvalue<string>("title")); // @ point mycollection contains items the type return mycollection;
Comments
Post a Comment