Referencing a property on the Site.Master?

I have added this line to my .aspx page:

MasterPageFile="~/Site.master"

Here is the start of the Site.Master.cs file:

    public partial class Site : System.Web.UI.MasterPage
    {
        public RDDBAdminDataStore RDDB { get; set; }

I get these squiggly lines in the Site.Master with the following error:
The name 'RDDB' does not exist in the current context.

When I compile, they go away, then shortly return.

Any idea what's wrong??

newbieweb
newbiewebSr. Software EngineerAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
käµfm³d 👽Connect With a Mentor Commented:
You either need to case "this.Master" to Site, as in:

RDDBAdminDataStore myVar = ((Site)this.Master).RDDB

Open in new window


or you can include the following directive in your content page:

<%@ MasterType TypeName="Nampespace.Site" %>

Open in new window



Then in code, you won't have to do the cast:

RDDBAdminDataStore myVar = this.Master.RDDB

Open in new window

0
 
newbiewebSr. Software EngineerAuthor Commented:
Header:

<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="TableList.aspx.cs" Inherits="RDDBWebAdmin.TableList" %>
0
 
käµfm³d 👽Connect With a Mentor Commented:
>>  You either need to case...

*cast
0
 
newbiewebSr. Software EngineerAuthor Commented:
Thanks!
0
 
käµfm³d 👽Commented:
NP. Glad to help  :  )
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.