How to get the property value of the page which is requested by user in episerver cms 10...
public string GetContent(string pageType, string propertyName)
{
Type type = Type.GetType(pageType); //target type
object o = Activator.CreateInstance(type);
var pageLink = new ContentReference();
var contentLoader= ServiceLocator.Current.GetInstance<IContentLoader>();
var content = contentLoader.Get<type>(pageLink);
var vals = content.GetPropertyValue(propertyName);
return vals;
}
In the above method i have get the page name and property name from the url .... so in this i have convert the variable pageType ( i.e. page name ) to class and use it in Get<> method..but it is not working...some body please tell me the solution... or else is there any other way to find property vakue of the user requested property in requeted page.....
The Answer for this question is :
Here I am passing CMS page name and property name to the method to get the corresponding property value..
I think you're misunderstanding some core concepts.
You should do something like the following:
If you really have to get a value by its property name:
var someOtherProperty = somePage.GetPropertyValue("SomeOtherPropertyName");