Filtering data dynamic data
Hi
I am trying to retrieve a list of module contents and filter on a specific field.
The code I currently have which appears to pull all the published items back looks like this.
01.
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
02.
Type mclEventType = TypeResolutionService.ResolveType(
"Telerik.Sitefinity.DynamicTypes.Model.McLEvents.MclEvent"
);
03.
04.
var theitems =
05.
dynamicModuleManager.GetDataItems(mclEventType).Where(
06.
s => s.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
;
07.
08.
grdFuture.DataSource = theitems;
09.
grdFuture.DataBind();
Hello,
To filter based on a certain field use GetValue followed by the field name you want to get. To use GetValue() add reference to Telerik.Sitefinity.Model.
using
Telerik.Sitefinity.Model;
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
Type mclEventType = TypeResolutionService.ResolveType(
"Telerik.Sitefinity.DynamicTypes.Model.McLEvents.MclEvent"
);
var theitems =
dynamicModuleManager.GetDataItems(mclEventType).Where(
s => s.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && s.GetValue(
"Title"
) ==
"Item1"
);
grdFuture.DataSource = theitems;
grdFuture.DataBind();
Hi Stanislav