473,714 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Null Exception error - Kindly help me

WebForm1.aspx Code:

<%@ Register TagPrefix="Comp onentArt" Namespace="Comp onentArt.Web.UI "
Assembly="Compo nentArt.Web.UI" %> <ComponentArt:T reeView
id="TreeView1" Height="520" AutoPostBackOnN odeMove="false"
DragAndDropEnab led="true"
NodeEditingEnab led="False" KeyboardEnabled ="true"
CssClass="TreeV iew" NodeCssClass="T reeNode"
SelectedNodeCss Class="Selected TreeNode"
HoverNodeCssCla ss="HoverTreeNo de" NodeEditCssClas s="NodeEdit"
LineImageWidth= "19" LineImageHeight ="20"
DefaultImageWid th="16" DefaultImageHei ght="16" ItemSpacing="0"
NodeLabelPaddin g="3" SpacerImageUrl= "/MRCSWebApp/Images/spacer.gif"
CollapseImageUr l="/MRCSWebApp/Images/exp.gif"
ExpandImageUrl= "/MRCSWebApp/Images/col.gif"
ParentNodeImage Url="/MRCSWebApp/Images/folders.gif"
LeafNodeImageUr l="/MRCSWebApp/Images/folder.gif"
ShowLines="true " LineImagesFolde rUrl="/MRCSWebApp/Images/lines/"
EnableViewState ="true"
ClientScriptLoc ation="~/client_scripts/componentart_we bui_client/"
runat="server"> </ComponentArt:Tr eeView>
BackEnd Code:

Imports MRCS_Class.File Utilities
Imports System.Data
Imports System.Data.Sql Client
Imports System.Data.Sql Types
Imports System.Data.Ole Db
Imports MRCS_Class.Logi nClass
Imports MRCSWebApp.Welc ome
Imports System.Data.Sql DbType
Imports System
Imports System.Collecti ons
Imports System.Componen tModel
Imports System.Drawing
Imports System.Web
Imports System.Web.Sess ionState
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Imports System.Web.UI.H tmlControls
Imports MRCS_Class.Sear ch
Imports ComponentArt.We b.UI
Public Class AdvancedSearch
Inherits System.Web.UI.P age
Public objDataReader As IDataReader

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

End Sub
Protected WithEvents TreeView1 As ComponentArt.We b.UI.TreeView
Protected WithEvents MRN As System.Web.UI.W ebControls.Text Box
Protected WithEvents SSN As System.Web.UI.W ebControls.Text Box
Protected WithEvents Lname As System.Web.UI.W ebControls.Text Box
Protected WithEvents Fname As System.Web.UI.W ebControls.Text Box
Protected WithEvents DOB As System.Web.UI.W ebControls.Text Box
Protected WithEvents AdvancedGrid As
System.Web.UI.W ebControls.Data Grid
Protected WithEvents AdvSearch As System.Web.UI.W ebControls.Butt on

'NOTE: The following placeholder declaration is required by the
Web Form Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region
Dim oConn As SqlConnection
Dim objReader As IDataReader
Public UserID As Int16
Dim FetchType As String
Dim oDS As New DataSet
Dim DView As DataView
Dim MenuID As Integer
Dim MenuProfileID As Integer

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
' If Not IsPostBack = True Then
ID = Request("GUID")
' End If
End Sub
Public Sub Login(ByVal GID)

Dim objCon As New SqlConnection(" Initial Catalog=MRCS;
Data Source=DEVBOX;u id=devuser;pwd= xxxx")
' Set Command object properties
Dim objCmd As New SqlCommand
Dim objCmd1 As New SqlCommand
With objCmd
.Connection = objCon
.CommandText = "procLogin_Retr eiveSession"
.CommandType = CommandType.Sto redProcedure
.Parameters.Add ("@SESSIONID ", SqlDbType.VarCh ar,
255).Value = GID
End With
objReader = objCmd.ExecuteR eader
objReader.Read( )
If Not objReader.IsDBN ull(0) Then
UserID = objReader.GetVa lue(0)
End If
objReader.Close ()

With objCmd1
.Connection = objCon
.CommandText = "procProfileDet ail_Retreive"
.CommandType = CommandType.Sto redProcedure
.Parameters.Add ("@UserID", SqlDbType.BigIn t).Value =
End With
objDataReader = objCmd1.Execute Reader
objDataReader.R ead()
If Not objDataReader.I sDBNull(0) Then
MenuProfileID = objDataReader.G etValue(0)
End If

buildTree(MenuP rofileID)
Catch ex As Exception
Dim clsError As MRCS_Class.File Utilities
clsError = New MRCS_Class.File Utilities
With clsError
.CreateErrorLog (Err.Number, Err.Description )
End With
End Try
End Sub
' Build Tree, Populate Sub Tree and Create Node are Used to create
the tree
Private Sub buildTree(ByVal MenuProfileID)

Dim dbCon As New SqlConnection(" Initial Catalog=MRCS; Data
Source=DEVBOX;u id=devuser;pwd= xxxxx")

Dim adapter As New SqlDataAdapter( "SELECT * FROM tblMenu LEFT
OUTER JOIN tblMenuProfileD etails ON tblMenu.MenuID =
tblMenuProfileD etails.MenuID WHERE tblMenuProfileD etails.MenuProf ileID
=" & MenuProfileID & "OR tblMenu.ParentN odeID IS NULL OR
tblMenu.ParentN odeID = 1 ORDER BY tblMenu.MenuID ASC", dbCon)
Dim ds As New System.Data.Dat aSet
adapter.Fill(ds )
ds.Relations.Ad d("NodeRelation ",
ds.Tables(0).Co lumns("MenuID") , ds.Tables(0).Co lumns("ParentNo deID"))
Dim dbRow As System.Data.Dat aRow
For Each dbRow In ds.Tables(0).Ro ws
If (dbRow.IsNull(" ParentNodeID")) Then
Dim newNode As ComponentArt.We b.UI.TreeViewNo de
newNode = CreateNode(dbRo w("Text").ToStr ing(),
dbRow("ImageURL ").ToString (), dbRow("RefURL") .ToString(), True)
TreeView1.Nodes .Add(newNode)
PopulateSubTree (dbRow, newNode)
End If
Next dbRow

End Sub
' Build Tree, Populate Sub Tree and Create Node are Used to create
the tree
Private Sub PopulateSubTree (ByVal dbRow As System.Data.Dat aRow,
ByVal node As ComponentArt.We b.UI.TreeViewNo de)
Dim childRow As System.Data.Dat aRow
For Each childRow In dbRow.GetChildR ows("NodeRelati on")
Dim childNode As ComponentArt.We b.UI.TreeViewNo de
childNode = New ComponentArt.We b.UI.TreeViewNo de
childNode = CreateNode(chil dRow("Text").To String(),
childRow("Image URL").ToString( ), childRow("RefUR L").ToString (), True)
node.Nodes.Add( childNode)
PopulateSubTree (childRow, childNode)
Next childRow
End Sub
' Build Tree, Populate Sub Tree and Create Node are Used to create
the tree
Private Function CreateNode(ByVa l text As String, ByVal imageurl
As String, ByVal refurl As String, ByVal expanded As Boolean) As
ComponentArt.We b.UI.TreeViewNo de
Dim MsgID As Integer
Dim PID As Integer
Dim MsgType As String
Dim node As ComponentArt.We b.UI.TreeViewNo de
node = New ComponentArt.We b.UI.TreeViewNo de
node.Text = text
node.ImageUrl = imageurl
node.Expanded = expanded
node.NavigateUr l = refurl & "?MsgID=" & Request("MsgID" ) &
"&PID=" & Request("PID") & "&MsgType=" & Request("MsgTyp e") & "&GUID="
& Request("GUID")

Return node
End Function

This returns a error as below:

Server Error in '/MRCSWebApp' 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.NullRefe renceException: 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:
[NullReferenceEx ception: Object reference not set to an instance of an
System.Web.UI.C ontrol.FindCont rol(String id, Int32 pathOffset) +178
System.Web.UI.C ontrol.FindCont rol(String id) +9
ComponentArt.We b.UI.BaseNaviga tor.UpdateSelec tedNode() +127
ComponentArt.We b.UI.BaseNaviga tor.OnLoad(Even tArgs e) +290
ComponentArt.We b.UI.TreeView.O nLoad(EventArgs e) +19
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.C ontrol.LoadRecu rsive() +98
System.Web.UI.C ontrol.LoadRecu rsive() +98
System.Web.UI.P age.ProcessRequ estMain() +731
Kindly help me out.
Thank you
Nov 18 '05 #1
0 1592

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

Similar topics

by: Chris Herring | last post by:
Hi there: Well, let me start off by saying that I am a Visual Studio drag and drop weenie, not a real programmer. So I tend to get confused when things do not look like the instructions said they were going to look :) . Here is my current dilemma: I am having a strange problem with my ASP.NET application. I am building the application using Visual Basic .Net in Visual Studio.NET 2003. Lately, I have frequently been getting the following...
by: rrober07 | last post by:
Hello, My Setup is I have a Web Server machine(Devweb01), Database SQL Machine(Devsql01), a Client Machine(local machine) I have configured the SQL machine as follows: 1) Added local Aspnet user account (with same password as aspnet user on IIS (Devweb01)) 2) edited local machine.config file <ProcessModel> Password attribute to same password (both on IIS and SQL Machine) 3) SQL Server security is Sql Server and Windows
by: Jim McGivney | last post by:
In asp 2.0 I am trying to insert a row using a detailsview control connected to an accessDataSource. I get the error message below. I am having trouble identifing which data field is causing the problem. Any suggestings are welcomed. Jim ************* You tried to assign the Null value to a variable that is not a Variant data type. Description: An unhandled exception occurred during the execution of the current web request. Please...
by: paul.dunstone | last post by:
HI all I am using msbuild to compile my web application project. After building the solution I get the following error message: Server Error in '/Community' Application. -------------------------------------------------------------------------------- Value cannot be null.
by: pauldepstein | last post by:
I have read about exception handling in a few books and websites but am still confused on a basic point. I understand the try ... catch syntax. However, I have seen examples of using throw where the throw-command is not in a try-block. What is the difference in meaning between throwing in a try block and throwing outside a try block?
by: Zorro | last post by:
The simplicity of stack unraveling of C++ is not without defective consequences. The following article points to C++ examples showing the defects. An engineer aware of defects can avoid hard-to-find bugs. http://distributed-software.blogspot.com/2007/01/c-exception-handling-is-defective.html Regards, zorabi@ZHMicro.com http://www.zhmicro.com http://distributed-software.blogspot.com
by: amitpatil | last post by:
I am having trouble with following error. there are few registration page when i register 2 members it works but when i try to create 3rd one i get following error and then for 10 mins or so website doesn't work. After 10 mins or so everything works till i do 3rd member's registration and again that error comes. Error Type: Active Server Pages error 'ASP 0115' Unexpected error
by: buntyindia | last post by:
Hi, I have a very strange problem with my application. I have developed it using Struts. I have a TextBox With Some fixed value in it and on Submit iam passing it to another page. <html:form action="/login"> <html:text property="userName" value="Bunty"/> <html:submit/>
by: crabsdf | last post by:
My project is a single method class which takes a xml object and, using Apache FOP, transforms it into a PDF which is returned as an output stream. Here is full code package transactionStatement; import javax.xml.transform.TransformerFactory; import javax.servlet.*; import org.jdom.*; import java.io.ByteArrayOutputStream; import java.io.File;
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.