Search:
Namespaces
Discussions
.NET v1.1
Feedback
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
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com