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

Problem using an assembly

I have a User Control that I created (.ascx & .ascx.vb file pair) that I am trying to put in a separate assembly. I know that the User Control works when it is in the same project and is compiled along with the project it is used in, so the problem is obviously something I am doing wrong with the references or something. My current code registers the assembly as:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="DatePickerTest.aspx.vb" Inherits="WebApplication1.DatePickerTest"%>

<%@ Register TagPrefix="NateCtrl" Namespace="NateCtrl" Assembly="NateCtrl" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<title>DatePickerTest</title>

<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">

<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">

<meta content="JavaScript" name="vs_defaultClientScript">

<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">

</HEAD>

<body>

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

<NateCtrl:DatePicker id="DatePickerCtrl" runat="server"></NateCtrl:DatePicker><BR><BR>

<asp:label id="lblSelectedDate" runat="server"></asp:label>

<asp:button id="btnRefresh" runat="server" Font-Bold="True" EnableViewState="False" Text="Refresh"></asp:button><BR><BR>

<asp:button id="btnXmas2000" runat="server" Font-Bold="True" EnableViewState="False" Text="Christmas 2000" CausesValidation="False"></asp:button><BR><BR>

<asp:button id="btnMyBirthday" runat="server" Font-Bold="True" EnableViewState="False" Text="My Birthday" CausesValidation="False"></asp:button><BR><BR>

<asp:button id="btnNewYear95" runat="server" Font-Bold="True" EnableViewState="False" Text="New Year's 1995" CausesValidation="False"></asp:button>

</form>

</body>

</HTML>
When I attempt to execute the page, I recieve the following error:


Server Error in '/WebApplication1' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 62: ViewState.Add("stopyear", Date.Today.Year + 25)
Line 63: For i As Integer = 1 To 12
Line 64: ddlMonth.Items.Add(New System.Web.UI.WebControls.ListItem(System.Globaliz ation.DateTimeFormatInfo.CurrentInfo.GetMonthName( i), CStr(i)))
Line 65: Next
Line 66: Me.CreateLists()

Source File: c:\inetpub\wwwroot\NateCtrl\DatePicker.ascx.vb Line: 64

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
NateCtrl.DatePicker.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\NateCtrl\DatePicker.ascx.vb:64
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Page.ProcessRequestMain() +750

What am I missing here? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
3 1063
HI
Can u see in the behind code is the ASCX declared. ASCX can work
independent of assemblies

-------
Regards ,
C#, VB.NET , SQL SERVER , UML , DESIGN Patterns Interview question book
http://www.geocities.com/dotnetinterviews/
My Interview Blog
http://spaces.msn.com/members/dotnetinterviews/

Nov 19 '05 #2
Hi,

Your @Register is wrong here is an example from one of my
projects.

<%@ Register TagPrefix="uc1" TagName="RssViewer" Src="RssViewer.ascx" %>

If drag the control from the solution explorer to the form you
want the control on. VB.net will add the @ register for you.

Ken
----------------
"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have a User Control that I created (.ascx & .ascx.vb file pair) that I am
trying to put in a separate assembly. I know that the User Control works
when it is in the same project and is compiled along with the project it is
used in, so the problem is obviously something I am doing wrong with the
references or something. My current code registers the assembly as:

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="DatePickerTest.aspx.vb"
Inherits="WebApplication1.DatePickerTest"%>
<%@ Register TagPrefix="NateCtrl" Namespace="NateCtrl" Assembly="NateCtrl"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>DatePickerTest</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<NateCtrl:DatePicker id="DatePickerCtrl"
runat="server"></NateCtrl:DatePicker><BR><BR>
<asp:label id="lblSelectedDate" runat="server"></asp:label>
<asp:button id="btnRefresh" runat="server" Font-Bold="True"
EnableViewState="False" Text="Refresh"></asp:button><BR><BR>
<asp:button id="btnXmas2000" runat="server" Font-Bold="True"
EnableViewState="False" Text="Christmas 2000"
CausesValidation="False"></asp:button><BR><BR>
<asp:button id="btnMyBirthday" runat="server" Font-Bold="True"
EnableViewState="False" Text="My Birthday"
CausesValidation="False"></asp:button><BR><BR>
<asp:button id="btnNewYear95" runat="server" Font-Bold="True"
EnableViewState="False" Text="New Year's 1995"
CausesValidation="False"></asp:button>
</form>
</body>
</HTML>

When I attempt to execute the page, I recieve the following error:
Server Error in '/WebApplication1' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

Line 62: ViewState.Add("stopyear", Date.Today.Year + 25)
Line 63: For i As Integer = 1 To 12
Line 64: ddlMonth.Items.Add(New
System.Web.UI.WebControls.ListItem(System.Globaliz ation.DateTimeFormatInfo.CurrentInfo.GetMonthName( i),
CStr(i)))
Line 65: Next
Line 66: Me.CreateLists()
Source File: c:\inetpub\wwwroot\NateCtrl\DatePicker.ascx.vb Line: 64

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
NateCtrl.DatePicker.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\NateCtrl\DatePicker.ascx.vb:64
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Page.ProcessRequestMain() +750


What am I missing here? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #3
On Sun, 9 Oct 2005 01:24:20 -0400, "Nathan Sokalski"
<nj********@hotmail.com> wrote:
I have a User Control that I created (.ascx & .ascx.vb file pair) that I am trying to put in a separate assembly. I know that the User Control works when it is in the same project and is compiled along with the project it is used in, so the problem is obviously something I am doing wrong with the references or something. My current code registers the assembly as:


It's not really possible to do this in 1.x, because Visual Studio
doesn't know how to compile the .ascx file into an assembly.
In 2.0 the ASP.NET runtime does all the compilation. I have a proof of
concept where I use the AspNet compiler to produce assemblies and
merge them together to reference from another project:
http://odetocode.com/Blogs/scott/arc...0/06/2326.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #4

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

Similar topics

12
by: SJD | last post by:
I've just read Christoph Schittko's article on XmlSerializer: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp . . . and very informative it is too....
3
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition...
3
by: Hamilton | last post by:
Hi there, I've seen this error appear a few times in newsgroups but unfortunately I haven't found one that actually provides a solution. I'm basically deploying a new website into an area at a...
8
by: Rob Edwards | last post by:
When trying to add the Microsoft CDO for Exchange Management Library (aka CDOEXM.dll) I receive the following message: "A reference to 'Microsoft CDO for Exchange Management Library' could not be...
1
by: abh1508 | last post by:
Following a release of code the following problem occurs on certain asp ..net pages. This is not a problem on other testing/demo environments. IIS seems to be creating certain files twice in the...
13
by: Lee Newson | last post by:
Hi, I have just written my first application using VB.NET. The app works fine when i am running it within .NET for debugging purposes, however when i try to run the app from the .exe file that...
3
by: Doug | last post by:
I'm having problems w/ the VS2005 debugger with C#. It blows past any breakpoints in even the simplest "Hello World" console application. I can't do any step-by-step debugging. I've provided the...
1
by: Tim F | last post by:
Problem: I'm receiving the error "File or assembly name XXXXX or one of its dependencies, was not found." when trying to execute code in an assmebly that has both a strong-name and has been...
5
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the...
0
by: Rafa | last post by:
Hello, First, sorry because I am spanish and my english are not good. My problem is that i am trying to work with profiles in visual studio 2005, but i have an error. the error is that: ...
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:
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
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
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
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
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...
0
tracyyun
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 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.