473,385 Members | 1,727 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,385 software developers and data experts.

asp.net 2.0 type not defined

I recently tried converting my asp.net 1.1 app to 2.0 in visual studio
2005 beta 2.

I get several "type xxx is not defined" errors.

It seems that some of my code file within my web application can no
longer see the types defined in my asp.vb files.

Here is a simple example:

default2.aspx.vb

Partial Public Class Default2
Inherits System.Web.UI.Page

Public m_1 As Integer

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim testc As New Class1
testc.load(Me)
End Sub
End Class

class1.vb

Public Class Class1

Public Sub load(ByVal p As Default2)

' ???
End Sub
End Class
class1.vb is in the App_Code directory.

the error is reported for class1.vb is:

Type "Default2" is not defined

why can't class1 see the type defined in the aspx.vb file?

something obvious i am sure, but i remain confused.

Nov 19 '05 #1
3 2773
Hey Phil,

I've heard this scenario should be working by the time 2.0 releases.

The problem is App_Code compiles into an assembly that does not
reference any of the assemblies containing web forms (because those
assemblies all reference App_Code and we don't want circular
references).

I believe what the ASP.NET team plans to do is generate stub classes
in App_Code, you could do the same to work around the problem now.

A stub class would be a base class that your web form code behind
class derives from. That gives you a Type you can use from App_Code to
manipulate the web form.

Something else you might consider is defining an interface in App_Code
for one or more web forms to inherit. Give the interface properties
and methods that will be common to the form(s) you need to interact
with and do so through the interface type instead of the web form
class.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On 30 Jul 2005 06:33:20 -0700, "phil" <pb*****@gmail.com> wrote:
I recently tried converting my asp.net 1.1 app to 2.0 in visual studio
2005 beta 2.

I get several "type xxx is not defined" errors.

It seems that some of my code file within my web application can no
longer see the types defined in my asp.vb files.

Here is a simple example:

default2.aspx.vb

Partial Public Class Default2
Inherits System.Web.UI.Page

Public m_1 As Integer

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim testc As New Class1
testc.load(Me)
End Sub
End Class

class1.vb

Public Class Class1

Public Sub load(ByVal p As Default2)

' ???
End Sub
End Class
class1.vb is in the App_Code directory.

the error is reported for class1.vb is:

Type "Default2" is not defined

why can't class1 see the type defined in the aspx.vb file?

something obvious i am sure, but i remain confused.


Nov 19 '05 #2
thanks Scott. your suggestion works fine. the problem is both obvious
and perplexing; i thought there was some implied/hidden namespace for
the web form side that i was missing. i bit perplexing because you
would think this would happen often enough that the fixes would have
been in beta 2.

is there a good document somewhere that describes the major things
microsoft plans to do between now and release? so far, this seems like
the only serious work around i will need to convert my application, but
i'd like to know what they know now...

thanks again for the great suggestion and prompt reply.

/phil

Nov 19 '05 #3
There are a few references to "in the final release the behavior will
be..." in "Common ASP.NET 2.0 Conversion Issues and Solutions" [1],
but I don't think the definitive guide has been put together as yet.
[1]
http://msdn.microsoft.com/asp.net/de...dingaspnet.asp

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 30 Jul 2005 11:56:50 -0700, "phil" <pb*****@gmail.com> wrote:
thanks Scott. your suggestion works fine. the problem is both obvious
and perplexing; i thought there was some implied/hidden namespace for
the web form side that i was missing. i bit perplexing because you
would think this would happen often enough that the fixes would have
been in beta 2.

is there a good document somewhere that describes the major things
microsoft plans to do between now and release? so far, this seems like
the only serious work around i will need to convert my application, but
i'd like to know what they know now...

thanks again for the great suggestion and prompt reply.

/phil


Nov 19 '05 #4

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

Similar topics

15
by: Terje Slettebų | last post by:
Hi. I'm new here, and sorry if this has been discussed before; I didn't find it searching the PHP groups. (I've also read recommendations to cross-post to the other PHP groups, but if that is...
4
by: Jari Kujansuu | last post by:
I can successfully parse XML document using SAX or DOM and I can also validate XML document against schema. Problem is that my program should deal with user-defined schemas which means that when...
4
by: Jacob Jensen | last post by:
This question has probably been asked a million time, but here it comes again. I want to learn the difference between the three type cast operators: static_cast, reinterpret_cast, dynamic_cast. A...
21
by: Nitin Bhardwaj | last post by:
Hi all, It is said that C++ is a strongly typed language and thus a type-safe language (unlike C). So how does one explain the following behaviour : int main(void) { char *p = NULL; p = "A...
8
by: Rade | last post by:
Following a discussion on another thread here... I have tried to understand what is actually standardized in C++ regarding the representing of integers (signed and unsigned) and their conversions....
13
by: dawatson833 | last post by:
I have several stored procedures with parameters that are defined with user defined data types. The time it takes to run the procedures can take 10 - 50 seconds depending on the procedure. If I...
14
by: Matt | last post by:
I want to know if "int" is a primitive type, or an object? For example, the following two approaches yield the same result. > int t1 = int.Parse(TextBox2.Text); //method 1 > int t2 =...
7
by: Michael | last post by:
Hi, I could understand the difference between class and object. However, I could find out a good definiton of type. how to understand the relaitonship between type, class, and object? Thanks! ...
70
by: garyusenet | last post by:
I'm using an example piece of code: - namespace Wintellect.Interop.Sound{ using System; using System.Runtime.InteropServices; using System.ComponentModel; sealed class Sound{ public static...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.