Not able to access EPiServer page Properities when a class file is used.

Vote:
 
Hi I have a Class file called SearchHit , which I have used for searching with in the EPiServer Pages. When I tried to access properities like "PageMetaData" I'm not able to get the values. Please check once. SearchHit Class: public SearchHit() { this.Id = 0; this.PageTitle = string.Empty; this.Url = string.Empty; this.PageMetaData = string.Empty; } public int Id { get; set; } public string PageTitle { get; set; } public string Url { get; set; } public IVCategoryCollection Categories { get; set; } Code I have used for Search and display of pages: var result = query .Select(x => new SearchHit { PageTitle = x.PageName, PageMetaData = x["PageMetaData"].ToString(), PageMetaData = CurrentPage["PageMetaData"].ToString(), Id=x.PageLink.ID, Url = x.LinkURL }) .Take(Count) .Track() .GetResult(); Results = result; foreach (var pItem in Results) { litTechnical.Text += "
  • "; litTechnical.Text += pItem.PageTitle + ""; litTechnical.Text += pItem.PageMetaData + "
  • "; } Please help me, What I'm still missing.
    #71748
    May 28, 2013 11:01
    Vote:
     

    You cannot use x["PageMetaData"] when using EPiServer Find. You'll have to make the property strongly typed. Create a new property on your baseclass called MetaData (or whatever you want), and do something like this:

    public string MetaData { get { return this["PageMetaData"] as string; } }

        

    #71790
    May 29, 2013 11:02
    Vote:
     
    Hi Found a solution for the same. I have used PageReference, Now I'm able to access the Properities. Thanks
    #71873
    May 31, 2013 8:57
    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.
    * You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.