I tried following the advice posted here: Set Property Value on Master Page from Content Page.
Specifically the last post about creating a class. However, visual studio keeps giving me an error on my default.aspx.cs page when i try to set the value:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : BasePage
{
protected override int NavHighlight
{
get { return new{0} ; }
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
It throws an error on new
, the error being: cannot inplicity convert anonymoustype#1 to int
Can someone tell me what i might have done wrong here?
Here s what my class looks like:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for BasePage
/// </summary>
public abstract class BasePage : System.Web.UI.Page
{
protected abstract int NavHighlight { get; }
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (this.Master != null)
{
//value assignment
}
}
public BasePage()
{
//
// TODO: Add constructor logic here
//
}
}
Thanks.