I have a user control with code behind of which two instances are
created/declared in my aspx page. The aspx page has code behind also, as
I need to access methods of the usercontrols on page submit.
I've read several post here and articles on the web on this topic. What
little I have learned from them is that you have to pre-compile the
usercontrol in order to access it in the aspx code behind. I did this,
compiling the usercontrol (CityGeoPosListBoxClass) into an assembly
(CityGeoPosSelectVB.dll), but I still can't get the app to compile. The
error I'm getting presently is:
Compiler Error Message: BC30002: Type 'CityGeoPosListBoxClass' is not
defined.
Source Error:
Line 12: Public Const dRadiusEarth As Double = 6366.707
Line 13:
Line 14: Public ucCityListBox1 As CityGeoPosListBoxClass
Line 15: Public ucCityListBox2 As CityGeoPosListBoxClass
Line 16:
, which is in Test.vb.
I believe my problems are how I set up the <@Control > and <@Register >
tags in the ascx and asp file, and not understanding how to
declare/reference the usercontrols in the aspx codebehind. So my
questions are:
What needs to go in the <@Control > and <@Register > tags to properly
register and access the assembly and it's usercontrols?
How exactly do you reference the controls in the aspx page code behind?
I'd appreciate any help on what I'm doing wrong here.
Thanks and Regards,
N. Demos
File List:
-----------
CityGeoPosSelect.ascx (usercontrol)
CityGeoPosSelect.vb (code behind for usercontrol)
Test.aspx (main page)
Test.vb (code behind for main page)
Here's the relevent code:
---------------------------
'********** CityGeoPosSelect.ascx **********
<%@ Control language="vb" inherits="CityGeoPosListBoxClass"
assembly="CityGeoPosSelectVB" %>
'a listbox and a couple textboxes ...
'********** CityGeoPosSelect.vb **********
Option Explicit
Option Strict
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.IO
Imports System.XML
Namespace GeoPos
Public Class CityGeoPosListBoxClass : Inherits System.Web.UI.UserControl
' Stuff ...
End Class
End Namespace
'********** Test.vb **********
Option Explicit
Option Strict
Imports System
Imports System.Collections
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports GeoPos
Public Class TestCodebehind : Inherits Page
Public Const dRadiusEarth As Double = 6366.707
Public ucCityListBox1 As CityGeoPosListBoxClass
Public ucCityListBox2 As CityGeoPosListBoxClass
' Other stuff ...
End Class
'********** Test.aspx **********
<%@ PAGE language="VB" debug="true" SmartNavigation="true" src="Test.vb"
inherits="TestCodebehind" %>
<%@ Register tagprefix="geo" namespace="GeoPos"
assembly="CityGeoPosSelectVB" %>
<html>
<body>
<form method="post" runat="server">
<geo:CityGeoPosListBoxClass id="ucCityListBox1" runat="server" />
<br />
<geo:CityGeoPosListBoxClass id="ucCityListBox2" runat="server" />
<br />
</div>
</form>
--
Change "seven" to a digit to email me. 2 1952
To put it simply, just create the user controls in your own projects itself,
and raise event from the user control. Capture these events in the page which
you are using.
"N. Demos" wrote: I have a user control with code behind of which two instances are created/declared in my aspx page. The aspx page has code behind also, as I need to access methods of the usercontrols on page submit.
I've read several post here and articles on the web on this topic. What little I have learned from them is that you have to pre-compile the usercontrol in order to access it in the aspx code behind. I did this, compiling the usercontrol (CityGeoPosListBoxClass) into an assembly (CityGeoPosSelectVB.dll), but I still can't get the app to compile. The error I'm getting presently is:
Compiler Error Message: BC30002: Type 'CityGeoPosListBoxClass' is not defined.
Source Error: Line 12: Public Const dRadiusEarth As Double = 6366.707 Line 13: Line 14: Public ucCityListBox1 As CityGeoPosListBoxClass Line 15: Public ucCityListBox2 As CityGeoPosListBoxClass Line 16:
, which is in Test.vb.
I believe my problems are how I set up the <@Control > and <@Register > tags in the ascx and asp file, and not understanding how to declare/reference the usercontrols in the aspx codebehind. So my questions are:
What needs to go in the <@Control > and <@Register > tags to properly register and access the assembly and it's usercontrols?
How exactly do you reference the controls in the aspx page code behind?
I'd appreciate any help on what I'm doing wrong here.
Thanks and Regards, N. Demos
File List: ----------- CityGeoPosSelect.ascx (usercontrol) CityGeoPosSelect.vb (code behind for usercontrol) Test.aspx (main page) Test.vb (code behind for main page)
Here's the relevent code: ---------------------------
'********** CityGeoPosSelect.ascx ********** <%@ Control language="vb" inherits="CityGeoPosListBoxClass" assembly="CityGeoPosSelectVB" %>
'a listbox and a couple textboxes ... '********** CityGeoPosSelect.vb ********** Option Explicit Option Strict
Imports System Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Data Imports System.IO Imports System.XML
Namespace GeoPos
Public Class CityGeoPosListBoxClass : Inherits System.Web.UI.UserControl ' Stuff ... End Class End Namespace '********** Test.vb ********** Option Explicit Option Strict
Imports System Imports System.Collections Imports System.Web.UI Imports System.Web.UI.WebControls Imports GeoPos
Public Class TestCodebehind : Inherits Page Public Const dRadiusEarth As Double = 6366.707
Public ucCityListBox1 As CityGeoPosListBoxClass Public ucCityListBox2 As CityGeoPosListBoxClass
' Other stuff ... End Class '********** Test.aspx ********** <%@ PAGE language="VB" debug="true" SmartNavigation="true" src="Test.vb" inherits="TestCodebehind" %> <%@ Register tagprefix="geo" namespace="GeoPos" assembly="CityGeoPosSelectVB" %>
<html> <body> <form method="post" runat="server"> <geo:CityGeoPosListBoxClass id="ucCityListBox1" runat="server" /> <br />
<geo:CityGeoPosListBoxClass id="ucCityListBox2" runat="server" /> <br /> </div> </form> -- Change "seven" to a digit to email me.
Prakash.NET wrote: To put it simply, just create the user controls in your own projects itself, and raise event from the user control. Capture these events in the page which you are using.
Prakash,
Thanks for replying. I'm not sure what you mean by raise events from the
control. I'm somewhat of a beginner with ASP.NET. Also, I'm not using
Visual Studio.
Basically, my usercontrol is an asp:listbox and an asp:textbox, with the
SelectedIndexChanged event handled on the listbox (which displays the
value of the selected listbox item in the textbox. The page has two of
these usercontrols, another textbox and a submit button. The onclick
event of the submit button gets the values from each of the selected
items in the usercontrol's listboxes, performs a calculation with them
and displays the result in the pages textbox.
Regards,
N. Demos
"N. Demos" wrote:
I have a user control with code behind of which two instances are created/declared in my aspx page. The aspx page has code behind also, as I need to access methods of the usercontrols on page submit.
I've read several post here and articles on the web on this topic. What little I have learned from them is that you have to pre-compile the usercontrol in order to access it in the aspx code behind. I did this, compiling the usercontrol (CityGeoPosListBoxClass) into an assembly (CityGeoPosSelectVB.dll), but I still can't get the app to compile. The error I'm getting presently is:
Compiler Error Message: BC30002: Type 'CityGeoPosListBoxClass' is not defined.
Source Error: Line 12: Public Const dRadiusEarth As Double = 6366.707 Line 13: Line 14: Public ucCityListBox1 As CityGeoPosListBoxClass Line 15: Public ucCityListBox2 As CityGeoPosListBoxClass Line 16:
, which is in Test.vb.
I believe my problems are how I set up the <@Control > and <@Register > tags in the ascx and asp file, and not understanding how to declare/reference the usercontrols in the aspx codebehind. So my questions are:
What needs to go in the <@Control > and <@Register > tags to properly register and access the assembly and it's usercontrols?
How exactly do you reference the controls in the aspx page code behind?
I'd appreciate any help on what I'm doing wrong here.
Thanks and Regards, N. Demos
File List: ----------- CityGeoPosSelect.ascx (usercontrol) CityGeoPosSelect.vb (code behind for usercontrol) Test.aspx (main page) Test.vb (code behind for main page)
Here's the relevent code: ---------------------------
'********** CityGeoPosSelect.ascx ********** <%@ Control language="vb" inherits="CityGeoPosListBoxClass" assembly="CityGeoPosSelectVB" %>
'a listbox and a couple textboxes ... '********** CityGeoPosSelect.vb ********** Option Explicit Option Strict
Imports System Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Data Imports System.IO Imports System.XML
Namespace GeoPos
Public Class CityGeoPosListBoxClass : Inherits System.Web.UI.UserControl ' Stuff ... End Class End Namespace '********** Test.vb ********** Option Explicit Option Strict
Imports System Imports System.Collections Imports System.Web.UI Imports System.Web.UI.WebControls Imports GeoPos
Public Class TestCodebehind : Inherits Page Public Const dRadiusEarth As Double = 6366.707
Public ucCityListBox1 As CityGeoPosListBoxClass Public ucCityListBox2 As CityGeoPosListBoxClass
' Other stuff ... End Class '********** Test.aspx ********** <%@ PAGE language="VB" debug="true" SmartNavigation="true" src="Test.vb" inherits="TestCodebehind" %> <%@ Register tagprefix="geo" namespace="GeoPos" assembly="CityGeoPosSelectVB" %>
<html> <body> <form method="post" runat="server"> <geo:CityGeoPosListBoxClass id="ucCityListBox1" runat="server" /> <br />
<geo:CityGeoPosListBoxClass id="ucCityListBox2" runat="server" /> <br /> </div> </form> -- Change "seven" to a digit to email me.
--
Change "seven" to a digit to email me. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Marc Mones |
last post by:
Hello,
I'working with IBM DB2 V8.1 and CLI/ODBC. I've got a problem with the
following
statement:
********************************************************************************
SELECT...
|
by: Earl Anderson |
last post by:
In A97, WXP, I have an employee form which, among other things, has a
textbox for that employee's assigned access card number . The form
also has two (2) Yes/No checkboxes. One checkbox is to...
|
by: Michael B. |
last post by:
I tend to use rather descriptive names for parameters, so the old style of
declaration appeals to me, as I can keep a declaration within 80 chars:
void * newKlElem...
|
by: Daniel Vallstrom |
last post by:
I'm having problems with inconsistent floating point behavior
resulting in e.g.
assert( x > 0.0 && putchar('\n') && x == 0.0 );
holding. (Actually, my problem is the dual one where I get...
|
by: Gary B. Levy |
last post by:
I need to install (for a developer associate. I am NOT a developer)VB.NET
versions 6 & 7 on two dissimilar hardware platforms, both running Windows XP
Professional with Service Pack 2. Both are...
|
by: Rik |
last post by:
Hello,
first of all, my provider sucks, newsserver is down for the #nth time
now, offcourse when I have an urgent question.... So this will be me
first time using Google Groups, forgive me if...
|
by: freegnu |
last post by:
how to declare a friend function that can access two class
it will look like the following
class A
{
private:
int i;
public:
A(){}
~A(){}
friend void call(A &a, B &b);
|
by: juan.gautier |
last post by:
Hi,
I try to construct a SQL code for a view to select a specific data
from a table, this query take the value of the filter from a text box
in a visual basic 6.0 form. my problem is when i...
|
by: satish mullapudi |
last post by:
Hi All,
This is a very general question, not pertaining to any vendor or
DBMS.
What is the difference between a DBMS & RDBMS ?
Can anyone pls provide a detailed explaination on this.
Awaiting...
|
by: Joe |
last post by:
I am just starting to use Object Oriented PHP coding, and I am seeing
quite often the following (this example taken from a wiki):
$wakka =& new Wakka($wakkaConfig);
What exactly is the =&, and...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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: 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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |