Solved

Error: "is not declared. It may be inaccessible due to its protection level."

Posted on 2015-02-05
2
460 Views
Last Modified: 2015-02-05
There is a 3rd-party calendar up and working on the web site.  The name of the page is EventsCalendar.aspx.vb.  See code below.

I copied the code and pasted it into another page named Daily_Living.aspx.vb, made the necessary changes, but get the error message "hlEditCalendar' is not declared. It may be inaccessible due to its protection level."  I must have overlooked something.

EventsCalendar.aspx.vb

Imports DHTMLX.Scheduler
Imports DHTMLX.Scheduler.Controls
Public Class EventsCalendar
    Inherits System.Web.UI.Page
    Public Scheduler As DHXScheduler

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Scheduler = New DHXScheduler
        'Scheduler.InitialDate = New DateTime(2011, 11, 24)
        Scheduler.Config.first_hour = 8
        Scheduler.Config.last_hour = 19
        Scheduler.Config.time_step = 30
        Scheduler.Config.isReadonly = True
        Scheduler.Config.limit_time_select = True
        Scheduler.DataAction = Me.ResolveUrl("~/Data.ashx")
        Scheduler.SaveAction = Me.ResolveUrl("~/Save.ashx")
        Scheduler.LoadData = True
        Scheduler.EnableDataprocessor = True

        If (Context.User.Identity.IsAuthenticated) Then
            hlEditCalendar.Visible = True

        Else
            hlEditCalendar.Visible = False
        End If


    End Sub
End Class

Open in new window


EventsCalendar.aspx

<%@ Page Title="Event Calendar" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="EventsCalendar.aspx.vb" Inherits="EventsCalendar" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
<br />
     <div class="Colored-background" >
        <div style="height:700px; width: 100%; margin-top:50px;">
            <%= Me.Scheduler.Render() %>
            <asp:HyperLink runat="server" ID="hlEditCalendar" NavigateUrl="~/EditCalendar">Edit Calendar</asp:HyperLink>
        </div>
    </div>
    
</asp:Content>

Open in new window


Daily_Living.aspx.vb

Imports DHTMLX.Scheduler
Imports DHTMLX.Scheduler.Controls
Public Class Daily_Living
    Inherits System.Web.UI.Page
    Public Scheduler As DHXScheduler

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Scheduler = New DHXScheduler
        'Scheduler.InitialDate = New DateTime(2011, 11, 24)
        Scheduler.Config.first_hour = 8
        Scheduler.Config.last_hour = 19
        Scheduler.Config.time_step = 30
        Scheduler.Config.isReadonly = True
        Scheduler.Config.limit_time_select = True
        Scheduler.DataAction = Me.ResolveUrl("~/Data.ashx")
        Scheduler.SaveAction = Me.ResolveUrl("~/Save.ashx")
        Scheduler.LoadData = True
        Scheduler.EnableDataprocessor = True

        If (Context.User.Identity.IsAuthenticated) Then
            hlEditCalendar.Visible = True  <---------------------- ERROR

        Else
            hlEditCalendar.Visible = False  <---------------------- ERROR
        End If


    End Sub
End Class

Open in new window


Daily_Living.aspx

<%@ Page Title="Daily Living" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Daily_Living.aspx.vb" Inherits="Daily_Living" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <%--<img src="images/willow-tree.jpg" id="bg" alt="" style="z-index: -1">--%>
    <br />
    <div class="Colored-background" >
        <div style="height:700px; width: 100%; margin-top:50px;">
            <%= Me.Scheduler.Render() %>
            <asp:HyperLink runat="server" ID="HyperLink1" NavigateUrl="~/EditCalendar">Edit Calendar</asp:HyperLink>
        </div>
    </div>
</asp:Content>

Open in new window

0
Comment
Question by:rrhandle8
2 Comments
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 40592607
hlEditCalendar does not exist in your Daily_Living.aspx mark-up:
Replace ID in your current page: (HyperLink1)
 <asp:HyperLink runat="server" ID="HyperLink1" NavigateUrl="~/EditCalendar">Edit Calendar</asp:HyperLink>

Open in new window


with: (hlEditCalendar)
 <asp:HyperLink runat="server" ID="hlEditCalendar" NavigateUrl="~/EditCalendar">Edit Calendar</asp:HyperLink>

Open in new window

0
 

Author Closing Comment

by:rrhandle8
ID: 40592641
Thanks for the second set of eyes.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now