I am very new to EpiServer and I want to develop a code for accessing property values of a page. I can access that using this code
PageData oPage = EPiServer.DataFactory.Instance.GetPage(new PageReference(30))
string str = oPage.Property["RestURL"].ToString();
TextBox1.Text = str;
but this is very hardcoded . So i want to access it dynamically like currentpage property values. but below code is giving error object reference is not set to an instabce of object.
public partial class Templates_Public_Pages_Scheduling : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//PageData oPage = EPiServer.DataFactory.Instance.GetPage(new PageReference());
//PageData oPage = EPiServer.DataFactory.Instance.GetPage(new PageReference(;
PageData oPage = EPiServer.DataFactory.Instance.CurrentPage;
string str = oPage.Property["RestURL"].ToString();
TextBox1.Text = str;
//Property property = CurrentPage["propertyname"];
}
}
Please help me to overcome this.