473,385 Members | 1,907 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.

object reference not set to an instance of an object

30
Hi Guys,

We have a aspx page on a web server that was created by someone who has now left our company which for some reason just started throwing an error, i have been looking into reasons for about 3 days now and am not getting any where, can any one put me in the right direction?

The error is:

Server Error in '/' 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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
Navision_sales_type_details.Page_Load(Object sender, EventArgs e) +101
System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) +24
System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender, EventArgs e) +41
System.Web.UI.Control.OnLoad(EventArgs e) +131
System.Web.UI.Control.LoadRecursive() +65
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2427

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3607; ASP.NET Version:2.0.50727.3082






The source code to the page being launch is

Expand|Select|Wrap|Line Numbers
  1. <%@ page language="C#" autoeventwireup="true" inherits="Navision_SalesInvoiceReport, App_Web_dev_rfop" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>Sales Invoice Report</title>
  8. </head>
  9. <body>
  10.     <form id="form1" runat="server">
  11.     <div style="text-align: center">
  12.         <br />
  13.         <br />
  14.         <asp:Button ID="Button1" runat="server" BackColor="#336699" BorderStyle="Ridge" Font-Bold="True"
  15.             Font-Names="Arial" ForeColor="#FFFFFF" OnClick="Button1_Click" Text="Export to Excel"
  16.             Width="165px" /><br />
  17.         <br />
  18.         <br />
  19.  
  20.         <asp:GridView ID="GridView1" runat="server"
  21.             AutoGenerateColumns="False" CellPadding="4" DataKeyNames="No_" DataSourceID="SqlDataSource1"
  22.             ForeColor="#333333" GridLines="None" PageSize="20">
  23.             <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
  24.             <Columns>
  25.                 <asp:BoundField DataField="No_" HeaderText="No_" ReadOnly="True" SortExpression="No_" />
  26.                 <asp:BoundField DataField="Sell-to Customer No_" HeaderText="Sell-to Customer No_"
  27.                     SortExpression="Sell-to Customer No_" />
  28.                 <asp:BoundField DataField="Bill-to Customer No_" HeaderText="Bill-to Customer No_"
  29.                     SortExpression="Bill-to Customer No_" />
  30.                 <asp:BoundField DataField="Bill-to Name" HeaderText="Bill-to Name" SortExpression="Bill-to Name" />
  31.                 <asp:BoundField DataField="Ship-to Name" HeaderText="Ship-to Name" SortExpression="Ship-to Name" />
  32.                 <asp:BoundField DataField="Order Date" HeaderText="Order Date" SortExpression="Order Date" />
  33.                 <asp:BoundField DataField="Posting Date" HeaderText="Posting Date" SortExpression="Posting Date" />
  34.                 <asp:BoundField DataField="Shortcut Dimension 1 Code" HeaderText="Shortcut Dimension 1 Code"
  35.                     SortExpression="Shortcut Dimension 1 Code" />
  36.                 <asp:BoundField DataField="Shortcut Dimension 2 Code" HeaderText="Shortcut Dimension 2 Code"
  37.                     SortExpression="Shortcut Dimension 2 Code" />
  38.                 <asp:BoundField DataField="Sell-to Customer Name" HeaderText="Sell-to Customer Name"
  39.                     SortExpression="Sell-to Customer Name" />
  40.                 <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
  41.                 <asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" />
  42.                 <asp:BoundField DataField="Unit Price" HeaderText="Unit Price" SortExpression="Unit Price" />
  43.                 <asp:BoundField DataField="Unit Cost (LCY)" HeaderText="Unit Cost (LCY)" SortExpression="Unit Cost (LCY)" />
  44.                 <asp:BoundField DataField="Amount" HeaderText="Amount" SortExpression="Amount" />
  45.                 <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
  46.                 <asp:BoundField DataField="Salesperson Code" HeaderText="Salesperson Code" SortExpression="Salesperson Code" />
  47.                 <asp:BoundField DataField="item_number" HeaderText="item_number" SortExpression="item_number" />
  48.                 <asp:BoundField DataField="Profit Amount" HeaderText="Profit Amount" SortExpression="Profit Amount" />
  49.                 <asp:BoundField DataField="Profit Margin %" HeaderText="Profit Margin %" SortExpression="Profit Margin %" />
  50.             </Columns>
  51.             <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
  52.             <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
  53.             <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
  54.             <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
  55.             <EditRowStyle BackColor="#999999" />
  56.             <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
  57.         </asp:GridView>
  58.        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:navision %>"
  59.             SelectCommand="SELECT [fakecompany Solutions Limited$Sales Invoice Header].No_, [fakecompany Solutions Limited$Sales Invoice Header].[Sell-to Customer No_], [fakecompany Solutions Limited$Sales Invoice Header].[Bill-to Customer No_], [fakecompany Solutions Limited$Sales Invoice Header].[Bill-to Name], [fakecompany Solutions Limited$Sales Invoice Header].[Ship-to Name], [fakecompany Solutions Limited$Sales Invoice Line].Type, CONVERT (varchar(11), [fakecompany Solutions Limited$Sales Invoice Header].[Order Date], 103) AS [Order Date], CONVERT (varchar(11), [fakecompany Solutions Limited$Sales Invoice Header].[Posting Date], 103) AS [Posting Date], [fakecompany Solutions Limited$Sales Invoice Header].[Shortcut Dimension 1 Code], [fakecompany Solutions Limited$Sales Invoice Header].[Shortcut Dimension 2 Code], [fakecompany Solutions Limited$Sales Invoice Header].[Sell-to Customer Name], [fakecompany Solutions Limited$Sales Invoice Line].Description, [fakecompany Solutions Limited$Sales Invoice Line].Quantity, [fakecompany Solutions Limited$Sales Invoice Line].[Unit Price], [fakecompany Solutions Limited$Sales Invoice Line].[Unit Cost (LCY)], [fakecompany Solutions Limited$Sales Invoice Line].Amount, [fakecompany Solutions Limited$Sales Invoice Header].[Salesperson Code], [fakecompany Solutions Limited$Sales Invoice Line].No_ AS item_number, [fakecompany Solutions Limited$Sales Invoice Line].[Profit Amount], [fakecompany Solutions Limited$Sales Invoice Line].[Profit Margin %] FROM [fakecompany Solutions Limited$Sales Invoice Line] INNER JOIN [fakecompany Solutions Limited$Sales Invoice Header] ON [fakecompany Solutions Limited$Sales Invoice Line].[Document No_] = [fakecompany Solutions Limited$Sales Invoice Header].No_ WHERE ([fakecompany Solutions Limited$Sales Invoice Header].[Posting Date] > GETDATE())">
  60.         </asp:SqlDataSource>
  61.  
  62.     </div>
  63.     </form>
  64. </body>
  65. </html>
Sorry that this is a lot of text, but i thought it may help someone point out the problem, Thanks in advance!
Apr 7 '10 #1
3 2300
Blacky
40
Hi,

This error might be coz of the improper intialization of the controls in aspx.cs page.So using breakpoint n debugging could help you in sorting this.

Thanks,
Blacky
Apr 7 '10 #2
CroCrew
564 Expert 512MB
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

Thanks,
CroCrew~
Apr 7 '10 #3
Frinavale
9,735 Expert Mod 8TB
You know, I don't think that the error is happening in the code you posted.

If you look at the error message you will see that it occurs in your Page Load event.

Could you please post the code for your Page Load event so we can see what's going on in the place where the error occurred?

-Frinny
Apr 7 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
6
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object...
15
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use...
3
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page...
4
by: Luke Matuszewski | last post by:
Here are some questions that i am interested about and wanted to here an explanation/discussion: 1. (general) Is the objectness in JavaScript was supported from the very first version of it (in...
12
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. ...
6
by: Shailen Sukul | last post by:
Observed a weird behaviour with object references. See code listing below: using System; using System.Collections.Generic; using System.Text; namespace PointerExceptionTest { /*
14
by: Philipp Reif | last post by:
Hi all, I've got a little hole in my head concerning references. Here's what I'm trying to do: I'm calling a function, passing the reference of a business object for editing. The function clones...
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
2
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
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: 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...
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
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.