By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,275 Members | 2,032 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,275 IT Pros & Developers. It's quick & easy.

Problem referencing usercontrol in page codebehind?

P: n/a
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

N. Demos
Compiler Error Message: BC30002: Type 'CityGeoPosSelectClass' is not

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

'********** 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" %>

<form method="post" runat="server">

<UserControl:CityGeoPosListBox id="ucCityListBox1" runat="server" />

<UserControl:CityGeoPosListBox id="ucCityListBox2" runat="server" />
<br />

' Textbox and Submit Button ...
'********** 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

Change "seven" to a digit to email me.
Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.