.NETGURU
Error:Object reference not set to an instance of an object.
Messages   Related Types
This message was discovered on microsoft.public.dotnet.faqs.

Post a new message to this list...

Suresh Kojhani
I m Using PageTemplate Class In Which I have Define All my Control Like
Textbox, Label, Dropdownlist. After That I inherit each page from This
Pagetemplate class...When i m trying to acess the DropdownList Control
it give me error "Object reference not set to an instance of an object."
All Other control Behave normailly..

Any one can Help Me.........

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply to this message...
 
    
Anushi
Hi Suresh,
Though you haven't provided enough details here, lemme try.
First of all, this dropdownlist control needs databinding. Check with your
control properties, if you are setting them right.
Check if you are setting the table property to a valid table reference.

Next, On a computer that has Microsoft .NET Framework 1.0 installed (and
that does not have Microsoft Visual Studio .NET installed), when you try to
access data using ADO Interop on an ASP.NET page that resides at an
identical site and that is hosted on the same computer, you may receive the
following error message:

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Look here for details:
http://support.microsoft.com/default.aspx?scid=kb;en-us;810098

As another reason, the control might just not be available to your compiler.
If you are using the OnItemDataBound event, you have to check first whether
the ListItemType is Item or AlternatingItem. You get the error because the
OnItemDataBound event is first executed for the HeaderTemplate, which
doesn't contain your control.

Use something like this:
Sub DataList1_ItemDataBound(sender As Object, _
e As DataListItemEventArgs)
If(e.Item.ItemType=ListItemType.Item Or _
e.Item.ItemType=ListItemType.AlternatingItem) Then
' your code here
End If

Specifically for web apps, session, by default, is set to be placed as
cookie. All I had to do is to set
cookieless="true" in web.config

Hope this helps.
Anushi

"Suresh Kojhani" <Click here to reveal e-mail address> wrote in message
news:%23vWHN9%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.NullReferenceException
System.Web.UI.WebControls.DataListItemEventArgs
System.Web.UI.WebControls.ListItemType




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification