I have imported a custom control to ASP.NET (C#), the control name is HijriGregDatePicker.ascx
which has a pop-up calendar on both Islamic and Gregorian Calendars. My Problem when Compiling HijriGregDatePicker.ascx.cs
I receive many errors of the type
Error CS0103 The name 'ctlCalendarLocalized' does not exist in the current context certificate \certificate\HijriGregDatePicker.ascx.cs
While inside the ASCX file the calendar exists as below:its inside a DIV in a PANEL
<asp:Calendar ID="ctlCalendarLocalized" runat="server" BackColor="White"
BorderColor="White"
Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Height="125px"
Width="275px" BorderWidth="1px" NextPrevFormat="FullMonth"
ShowDayHeader="True" ShowNextPrevMonth="False"
OnSelectionChanged="ctlCalendarLocalized_SelectionChanged">
<DayHeaderStyle Font-Bold="True" Font-Size="7pt" Font-Names="Tahoma" />
<NextPrevStyle VerticalAlign="Bottom" Font-Bold="True" Font-Size="8pt"
ForeColor="#333333" />
<OtherMonthDayStyle ForeColor="#999999" />
<SelectedDayStyle BackColor="#333399" ForeColor="White" />
<TitleStyle BackColor="White" BorderColor="Black" Font-Bold="True"
BorderWidth="1px" Font-Size="9pt" ForeColor="#333399" BorderStyle="Ridge" Font-Names="sans-serif" />
<TodayDayStyle BackColor="#CCCCCC" />
</asp:Calendar>
One of the solutions I found on the web was importing all Web references like below
using System;
using System.Drawing;
using System.Web.Configuration;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
But this didn't help, another solution was the inheritance in HijriGregDatePicker.ascx
Which was like this:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HijriGregDatePicker.ascx.cs"
Inherits="HijriGregDatePicker.ascx" %>
I tried removing the inheritance tag, but still the same.