I am trying to return a list of pages where a property is not set or not defined against the page as:
...
but no pages are ever returned even though some do exist.
However the control works ok if I test for an explicit date value.
Therefore how do you test a property for null using PropertyCriteriaControl?
During the course of experimenting with this, we came across the following problem:
If you omit the Type="Date" attribute and set IsNull="true", you get an exception as:
[EPiServerException: The Type set on the criteria is not supported: -1]
EPiServer.DataAccess.PropertySearchDB.ExecuteCriteria(PropertyCriteria criteria, IDbCommand cmd, Int32 SID, Int32 pageID, Boolean firstQuery, PageReferenceCollection pageLinks) +1142
EPiServer.DataAccess.PropertySearchDB.FindPagesWithCriteria(Int32 SID, PageReference pageLink, PropertyCriteriaCollection criterias) +150
EPiServer.DataFactory.FindPagesWithCriteria(PageReference pageLink, PropertyCriteriaCollection criterias, AccessLevel requiredAccess) +495
EPiServer.DataFactory.FindPagesWithCriteria(PageReference pageLink, PropertyCriteriaCollection criterias) +22
EPiServer.WebControls.PropertySearch.PopulatePages(PageDataCollection pages) +78
EPiServer.WebControls.PageControlBase.ᐁ() +44
EPiServer.WebControls.PageControlBase.GetEnumerator() +9
EPiServer.WebControls.PageControlBase.ᐁ(PageDataCollection ) +34
EPiServer.WebControls.PageControlBase.ᐁ() +31
EPiServer.WebControls.NewsList.CreateChildControls() +51
EPiServer.WebControls.PageControlBase.DataBind() +245
System.Web.UI.Control.DataBind() +86
System.Web.UI.Control.DataBind() +86
System.Web.UI.Control.DataBind() +86
System.Web.UI.Control.DataBind() +86
System.Web.UI.Control.DataBind() +86
System.Web.UI.Control.DataBind() +86
System.Web.UI.Control.DataBind() +86
System.Web.UI.Control.DataBind() +86
System.Web.UI.Control.DataBind() +86
System.Web.UI.Control.DataBind() +86
development.Default.Page_Load(Object sender, EventArgs e) in C:\Inetpub\EPiUBU\default.aspx.cs:39
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
but not if you set IsNull="false".
[EPiServerException: The Type set on the criteria is not supported: -1] EPiServer.DataAccess.PropertySearchDB.ExecuteCriteria(PropertyCriteria criteria, IDbCommand cmd, Int32 SID, Int32 pageID, Boolean firstQuery, PageReferenceCollection pageLinks) +1142 EPiServer.DataAccess.PropertySearchDB.FindPagesWithCriteria(Int32 SID, PageReference pageLink, PropertyCriteriaCollection criterias) +150 EPiServer.DataFactory.FindPagesWithCriteria(PageReference pageLink, PropertyCriteriaCollection criterias, AccessLevel requiredAccess) +495 EPiServer.DataFactory.FindPagesWithCriteria(PageReference pageLink, PropertyCriteriaCollection criterias) +22 EPiServer.WebControls.PropertySearch.PopulatePages(PageDataCollection pages) +78 EPiServer.WebControls.PageControlBase.ᐁ() +44 EPiServer.WebControls.PageControlBase.GetEnumerator() +9 EPiServer.WebControls.PageControlBase.ᐁ(PageDataCollection ) +34 EPiServer.WebControls.PageControlBase.ᐁ() +31 EPiServer.WebControls.NewsList.CreateChildControls() +51 EPiServer.WebControls.PageControlBase.DataBind() +245 System.Web.UI.Control.DataBind() +86 System.Web.UI.Control.DataBind() +86 System.Web.UI.Control.DataBind() +86 System.Web.UI.Control.DataBind() +86 System.Web.UI.Control.DataBind() +86 System.Web.UI.Control.DataBind() +86 System.Web.UI.Control.DataBind() +86 System.Web.UI.Control.DataBind() +86 System.Web.UI.Control.DataBind() +86 System.Web.UI.Control.DataBind() +86 development.Default.Page_Load(Object sender, EventArgs e) in C:\Inetpub\EPiUBU\default.aspx.cs:39 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +750
but not if you set IsNull="false".