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 'CityGeoPosSele ctClass' 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 'CityGeoPosSele ctClass' is not
defined.
Source Error:
Line 11: Public Class CityGeoTestCode behind : Inherits Page
Line 12: Public dRadiusEarth As Double
Line 13: Public ucCityListBox1 As CityGeoPosSelec tClass
Line 14: Public ucCityListBox2 As CityGeoPosSelec tClass
Line 15:
Source File: C:\BegASPNET\ch 16\CityGeoPosTe st.vb Line: 13
CODE:
-----------
'********** CityGeoPosSelec t.ascx **********
<%@ Control inherits="CityG eoPosSelectClas s" debug="true"
src="CityGeoPos Select.vb" classname="City GeoPosListBox" %>
<ASP:listbox id="lstbxCities " autoPostBack="T rue"
onSelectedIndex Changed="ShowVa lue" rows="20" runat="server" />
<br /><br />
<span>Latitud e: </span>
<ASP:textbox id="tbxLatCoord " rows="1" runat="server" />
<br />
<span>Longitude : </span>
<ASP:textbox id="tbxLongCoor d" rows="1" runat="server" />
<br />
<ASP:label id="lblCGPLBMon " runat="server" />
'********** CityGeoPosSelec t.vb **********
Option Explicit
Option Strict
Imports System
Imports System.Collecti ons
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Imports System.Data
Imports System.IO
Imports System.XML
Public Class CityGeoPosSelec tClass : 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="CityGeoPos Test.vb"
inherits="CityG eoTestCodebehin d" %>
<%@ Register TagPrefix="User Control" TagName="CityGe oPosListBox"
Src="CityGeoPos Select.ascx" %>
<html>
<head>
</head>
<body>
<form method="post" runat="server">
<UserControl:Ci tyGeoPosListBox id="ucCityListB ox1" runat="server" />
<UserControl:Ci tyGeoPosListBox id="ucCityListB ox2" runat="server" />
<br />
' Textbox and Submit Button ...
</form>
</body>
</html>
'********** CityGeoPosTest. vb **********
Option Explicit
Option Strict
Imports System
Imports System.Collecti ons
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Public Class CityGeoTestCode behind : Inherits Page
Public dRadiusEarth As Double
'!!! Error Occurs Here !!!
Public ucCityListBox1 As CityGeoPosSelec tClass
Public ucCityListBox2 As CityGeoPosSelec tClass
Public tblDistMiles As TextBox
' Member Functions and Subs (Page_Load() etc ...)
End Class
--
Change "seven" to a digit to email me.