473,387 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem referencing usercontrol in page codebehind?

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


--
Change "seven" to a digit to email me.
Nov 19 '05 #1
0 1509

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: bill yeager | last post by:
When trying to run my web project, I get the following error: Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the...
1
by: Kris van der Mast | last post by:
Hi, been a while since I posted a question myself instead of trying to help others out. I'm refactoring an existing web app that uses dynamic loading of user controls and a lot of...
2
by: crjunk | last post by:
I have a droped a UserControl named "ReceivedRecord1" onto my web form. Currently, I have been saving information typed in by the user with the following code that is located in the CodeBehind...
6
by: Pete Davis | last post by:
I'm fairly weak with ASP.NET. What I'm trying to do is pass an attribute to a UserControl. The attribute is a value from the CodeBehind for the page. So in my .aspx I have the following: ...
1
by: Will Gillen | last post by:
I know this has probably been asked before, but I can't seem to find a solid answer in any of the archives. First, before my question, please forgive my limited knowledge of the event lifecycle...
2
by: Alex Maghen | last post by:
I want to create a utility function that will seach the current page for one of my UserControls by it's type. So, let's say that I have a UserControl whose class I defined as follows: namespace...
2
by: gerry | last post by:
based on MSPress's ASP.NET 2.0 Applications Advaced Topics ( Table 12-3 p.472 ), and most events should be automatically wired up when @Control AutoEventWireup="true". ie. Page_InitComplete() {}...
10
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's...
14
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I have created a UserControl ("MyUC"). I've put a bunch of instances of that control on a Page ("Defaul.aspx"). The control works fine. Now, I want to be able to use "FindControl()" from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.