?
Solved

Object reference not set to an instance of an object.

Posted on 2006-06-29
3
Medium Priority
?
861 Views
Last Modified: 2008-01-09
Hello,

i am using the infragistics web tree controled and on my page load I am having  this error
Object reference not set to an instance of an object. the line that is causing it is below

igTree.Nodes[0].Selected =true ;

here is my page_load code
 protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            lblId.Text = Request["ParentTitle"];
                               
             LoadTree(Request["ParentTitle"]);
            igTree.Nodes[0].Selected =true ;
           
            PopulateUnassignedData();
                                   
         }
         AdminID = Session["admin_id"].ToString();
     }
0
Comment
Question by:jemigossaye
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 25

Accepted Solution

by:
dstanley9 earned 1200 total points
ID: 17012562
then either igTree or igTree.Nodes[0] is null.  Run it in the debugger and see which is null.  What is the code for LoadTree?
0
 
LVL 12

Assisted Solution

by:topdog770
topdog770 earned 800 total points
ID: 17012640
Yeah... it's likely that even if you are do a igTree = new 'WhatEverTheObjectNameIs'
that the nodes haven't been added the first time into the page.

Without seeing the code behind this.. I'd think that you will either need to add the node, first, OR make sure that the LoadTree function is working the way it's supposed to prior to setting the Selected value to true..

Simple check.. that may not provide the functionality you need long term would be to do something like this...

if( igTree != null && igTree.Nodes != null && igTree.Nodes.Count > 0 )
      igTree.Nodes[0].Selected =true ;

0
 

Author Comment

by:jemigossaye
ID: 17012737
okay thanks I had done some major damage to myself the loadtree was not retruning any values rather i wasn't retruning my dataset. what a day


thanks all
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question