how to compage properties which are pagereference

Vote:
 
how to compage properties which are pagereference
#23851
Sep 17, 2008 15:43
Vote:
 

Hi,

You can get your property by creating a helper class like this:

public static PageReference GetPropertyPageReference(PageData pd, string propertyName)
        {
            return ((pd[propertyName] as PageReference) ?? PageReference.EmptyReference);
        }

 You call it like this:

PageReference pr = GetPropertyPageReference(YourPage, YourPropertyName);

 If your PageReferences isn't EmptyReference (PageReference.EmptyReference), then you can compare your PageReferences by using it's ID property like this:

If(PageRefOne.ID == PageRef2.ID)

{

//Do your thing

}

 OR use:

PageRefOne.CompareTo(PageRef2)

 -Kjetil Simensen

#23853
Edited, Sep 17, 2008 15:54
Vote:
 

could I do something like: PropertyCriteria responsibilities = new PropertyCriteria();
                    responsibilities.Type = PropertyDataType.Pagereference;
                    responsibilities.Name = "Responsibilities";
                    responsibilities.Condition = CompareCondition.Equal;
                    responsibilities.Value = ????                    criteriaCollection.Add(responsibilities);

#23857
Sep 17, 2008 16:40
Vote:
 

Not tried to use it in a FindPagesWithCriteria. Do you have to use this or can you make your own filter/search?

-Kjetil

#23866
Sep 17, 2008 17:46
Vote:
 

Hi Hua Wu!

Could you let us know what data type you selected in the combo box when you added the "Responsibilites" property.

/Fredrik 

#23868
Sep 17, 2008 18:23
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.