473,386 Members | 1,790 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,386 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 21 '05 #1
3 1008
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 21 '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 21 '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 21 '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....
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...
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: 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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.