Hi Karl!
The PropertyDataType property should match the Type property of the Property class that you have for your custom property (A custom property is made up of both a property and a property control class). This might of course be inherrited from parent controls. For instance, this is the implementation in the PropertyString class:
public override PropertyDataType Type { get { return PropertyDataType.String; } }
Regards
Linus Ekström
Hi Linus,
Thanks for your answer!
The resultset isn't being affected by my property however. Last time this happened, it was because I was trying to search for a pagetypeid when I was selecting an integer as a type. It didn't cause any errors, but at the same time it didn't narrow down my resultset.
My property does indeed inherit from PropertyString, though my typeId of my property is 1003.
Any ideas?
Thanks for your help so far!
Karl.
Hi again!
I'm not 100% sure of exacly what it is that you are trying to acomplish but I'll make a guess. You have created a custom property which you have implemented on a page type and want to search for all pages that have this property with a specific value. The code should look something like this in that case:
PropertyCriteria criteria = new PropertyCriteria();
criteria.Name = "[The name of your instanced property on the page type]";
criteria.Condition =
EPiServer.Filters.CompareCondition.Contained;
criteria.Type = PropertyDataType.String;
criteria.Value = [Your search value]
criterias.Add(criteria);
If what you are trying to do instead is to find all pages that have a instanced property of your custom type (unregarding of the actual property names) then I'm not sure if that is possible to do actually.
Hope that this helps
Hi Linus,
Thanks very much for your comments.
Your first guess is correct.
propEventType.Type = PropertyDataType.String;
propEventType.Condition = EPiServer.Filters.CompareCondition.Contained;
propEventType.Name = "HeadlineClubEventType";
propEventType.Value = type == HeadlineClubType.Club ? "Club" : "Headline";
This code produces "Headline" content regardless of when Club or Headline is specified in the value. Stepping through the code shows no clues either.
I am adding the property to the collection with a value of "Club".
I am executing the search
I am getting a page back with the property containing the value of "Headline".
I'm extremely confused! :(
Do you have any other suggestions?
Thanks,
Karl.
So you're custom property is a dropdown with two values Club and Headline? And they are stored as those strings?
In that case your search should work. I would however use CompareCondition.Equals
Note also that if you search for more propertycriterias then if don't set the Requiered property to true an OR seasrch will be executed.
Ah ha!
Sorry guys, that's what i was doing wrong! I do remember hearing something about ands only being ands when they're required. that was the problem!
Thanks very much for your help. You've saved many many headaches! :-)
Cheers,
Karl.
Hi,
I'm using this blog for searching for pages:
http://labs.episerver.com/en/Blogs/Ted-Nyberg/Dates/112276/2/Search-for-EPiServer-pages-based-on-properties/
Which is terrific, though how would you alter the PropertyDataType property to search for a custom property I develop myself? Choosing PropertyDataType.String isn't changing my resultset!
I've created a custom property which has the property type of 1003. The custom property inherits from the PropertySelectControlBase if that helps?
Thanks very much!
Karl.