N
N. Demos
Hello,
I have a custom usercontrol, of which I have two instances of in my aspx
page. Both the usercontrol and page have codebehind. In the page
codebehind, I want a member variable for each usercontrol. My problem is
that I keep getting a compiler error on the usercontrol variables in my
page codebehind (BC30002: Type 'CityGeoPosSelectClass' is not defined.)
For whatever reason, my usercontrol class is not being declared in the
page codebehind file. I've read every article I could find on this and I
still can't seem to get this to work. I would greatly appreciate if
someone would take a look at this and give me some pointers on what I'm
doing wrong here (relevant code below).
I'm not using Visual Studio .NET to develop this, and my version of the
..NET framework is 1.1.4322.573 with IIS 5.1. Thanks for your time and
attention.
Regards,
N. Demos
ERROR MESSAGE:
---------------
Compiler Error Message: BC30002: Type 'CityGeoPosSelectClass' is not
defined.
Source Error:
Line 11: Public Class CityGeoTestCodebehind : Inherits Page
Line 12: Public dRadiusEarth As Double
Line 13: Public ucCityListBox1 As CityGeoPosSelectClass
Line 14: Public ucCityListBox2 As CityGeoPosSelectClass
Line 15:
Source File: C:\BegASPNET\ch16\CityGeoPosTest.vb Line: 13
CODE:
-----------
'********** CityGeoPosSelect.ascx **********
<%@ Control inherits="CityGeoPosSelectClass" debug="true"
src="CityGeoPosSelect.vb" classname="CityGeoPosListBox" %>
<ASP:listbox id="lstbxCities" autoPostBack="True"
onSelectedIndexChanged="ShowValue" rows="20" runat="server" />
<br /><br />
<span>Latitude: </span>
<ASP:textbox id="tbxLatCoord" rows="1" runat="server" />
<br />
<span>Longitude: </span>
<ASP:textbox id="tbxLongCoord" rows="1" runat="server" />
<br />
<ASP:label id="lblCGPLBMon" runat="server" />
'********** CityGeoPosSelect.vb **********
Option Explicit
Option Strict
Imports System
Imports System.Collections
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.IO
Imports System.XML
Public Class CityGeoPosSelectClass : Inherits UserControl
Public lstbxCities As ListBox
Public lblCGPLBMon As Label
Public tbxLatCoord As TextBox
Public tbxLongCoord As TextBox
' Member Functions and Subs ...
End Class
'********** CityGeoPosTest.aspx **********
<%@ PAGE language="VB" debug="true" src="CityGeoPosTest.vb"
inherits="CityGeoTestCodebehind" %>
<%@ Register TagPrefix="UserControl" TagName="CityGeoPosListBox"
Src="CityGeoPosSelect.ascx" %>
<html>
<head>
</head>
<body>
<form method="post" runat="server">
<UserControl:CityGeoPosListBox id="ucCityListBox1" runat="server" />
<UserControl:CityGeoPosListBox id="ucCityListBox2" runat="server" />
<br />
' Textbox and Submit Button ...
</form>
</body>
</html>
'********** CityGeoPosTest.vb **********
Option Explicit
Option Strict
Imports System
Imports System.Collections
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Class CityGeoTestCodebehind : Inherits Page
Public dRadiusEarth As Double
'!!! Error Occurs Here !!!
Public ucCityListBox1 As CityGeoPosSelectClass
Public ucCityListBox2 As CityGeoPosSelectClass
Public tblDistMiles As TextBox
' Member Functions and Subs (Page_Load() etc ...)
End Class
I have a custom usercontrol, of which I have two instances of in my aspx
page. Both the usercontrol and page have codebehind. In the page
codebehind, I want a member variable for each usercontrol. My problem is
that I keep getting a compiler error on the usercontrol variables in my
page codebehind (BC30002: Type 'CityGeoPosSelectClass' is not defined.)
For whatever reason, my usercontrol class is not being declared in the
page codebehind file. I've read every article I could find on this and I
still can't seem to get this to work. I would greatly appreciate if
someone would take a look at this and give me some pointers on what I'm
doing wrong here (relevant code below).
I'm not using Visual Studio .NET to develop this, and my version of the
..NET framework is 1.1.4322.573 with IIS 5.1. Thanks for your time and
attention.
Regards,
N. Demos
ERROR MESSAGE:
---------------
Compiler Error Message: BC30002: Type 'CityGeoPosSelectClass' is not
defined.
Source Error:
Line 11: Public Class CityGeoTestCodebehind : Inherits Page
Line 12: Public dRadiusEarth As Double
Line 13: Public ucCityListBox1 As CityGeoPosSelectClass
Line 14: Public ucCityListBox2 As CityGeoPosSelectClass
Line 15:
Source File: C:\BegASPNET\ch16\CityGeoPosTest.vb Line: 13
CODE:
-----------
'********** CityGeoPosSelect.ascx **********
<%@ Control inherits="CityGeoPosSelectClass" debug="true"
src="CityGeoPosSelect.vb" classname="CityGeoPosListBox" %>
<ASP:listbox id="lstbxCities" autoPostBack="True"
onSelectedIndexChanged="ShowValue" rows="20" runat="server" />
<br /><br />
<span>Latitude: </span>
<ASP:textbox id="tbxLatCoord" rows="1" runat="server" />
<br />
<span>Longitude: </span>
<ASP:textbox id="tbxLongCoord" rows="1" runat="server" />
<br />
<ASP:label id="lblCGPLBMon" runat="server" />
'********** CityGeoPosSelect.vb **********
Option Explicit
Option Strict
Imports System
Imports System.Collections
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.IO
Imports System.XML
Public Class CityGeoPosSelectClass : Inherits UserControl
Public lstbxCities As ListBox
Public lblCGPLBMon As Label
Public tbxLatCoord As TextBox
Public tbxLongCoord As TextBox
' Member Functions and Subs ...
End Class
'********** CityGeoPosTest.aspx **********
<%@ PAGE language="VB" debug="true" src="CityGeoPosTest.vb"
inherits="CityGeoTestCodebehind" %>
<%@ Register TagPrefix="UserControl" TagName="CityGeoPosListBox"
Src="CityGeoPosSelect.ascx" %>
<html>
<head>
</head>
<body>
<form method="post" runat="server">
<UserControl:CityGeoPosListBox id="ucCityListBox1" runat="server" />
<UserControl:CityGeoPosListBox id="ucCityListBox2" runat="server" />
<br />
' Textbox and Submit Button ...
</form>
</body>
</html>
'********** CityGeoPosTest.vb **********
Option Explicit
Option Strict
Imports System
Imports System.Collections
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Class CityGeoTestCodebehind : Inherits Page
Public dRadiusEarth As Double
'!!! Error Occurs Here !!!
Public ucCityListBox1 As CityGeoPosSelectClass
Public ucCityListBox2 As CityGeoPosSelectClass
Public tblDistMiles As TextBox
' Member Functions and Subs (Page_Load() etc ...)
End Class