Solved

Object reference not set to an instance of an object.

Posted on 2006-06-29
3
855 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 300 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 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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