473,586 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 '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.
Nov 19 '05 #1
0 1525

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

Similar topics

2
2660
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 following specific parse error details and modify your source file appropriately. Parser Error Message: The base class includes the
1
2292
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 response.redirects to the same page. Because I hate the overhead by doing this I'm searching for a cleaner option. But I'm having troubles (off course or I...
2
1856
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 page of my Web Form. For Each ctrl In Page.FindControl("ReceivedRecord1").Controls If TypeOf (ctrl) Is TextBox Then ' yada yada yada End If Next
6
1929
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: <cm:Comments runat="server" ID="Comments1" CommentType="News" ItemID="<%= NewsItemID %>" /> NewsItemID is a property in the CodeBehind for the page.
1
6850
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 and page loading/rendering lifecycle.... Ok, now for the question: I have an ASPX page (page.aspx), and I have a UserControl (control.ascx). The...
2
1646
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 MyUtils { public partial class SomeUserControl : System.Web.UI.UserControl { ... }
2
3382
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() {} should be invoked automatically without having to wire up the event as : Page.InitComplete+=new EventHandler(Page_InitComplete); It seems that this...
10
2409
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 my question. Once the UserControl is dropped onto the container page, how can I perform some action on the codebehind of the container page from...
14
3187
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 within my Default.aspx as follows: MyUC C = (MyUC)this.FindControl("SomeID"); When I try to run this, I get error: "The type or namespace name...
0
7912
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.