29 June 2013

Set Property Value on Master Page from Content Page ASP.NET

Set Property Value on Master Page from Content Page


Create a property in your master page and you access it from content page:
Master page:
public partial class BasePage : System.Web.UI.MasterPage
{
    private string[] _RequiredRoles = null;

    public string[] RequiredRoles
    {
        get { return _RequiredRoles; }
        set { _RequiredRoles = value; }
    }
}
Content Page:
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load()
    {
        Master.RequiredRoles = new string[] { //set appropriate roles };
    }
}

No comments:

Post a Comment

Comments Welcome

Implementing OAuth validation in a Web API

 I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...