Solved

dropdownlist : Object reference not set to an instance of an object.

Posted on 2011-03-22
6
504 Views
Last Modified: 2012-05-11
I have a page where this dropdownlist is hidden ddlDepartamento
 but elsewhere in the code asks for this combo as follows
If ddlDepartamento.SelectedItem.Value.Equals("%") Then
 therefore I have this error:
 Object reference not set to an instance of an object.
 as I can ask for a dropdownlist that is not visible in the html
0
Comment
Question by:enrique_aeo
  • 3
  • 2
6 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 35194065
What function/method are you calling If ddlDepartamento.SelectedItem.Value.Equals("%") Then in?
0
 
LVL 16

Expert Comment

by:Imran Javed Zia
ID: 35194069
Hi,
when you make control Visible="false" then it is not rendered in output, you can use css style hidden as
style="display:none"
Hope it will help
Thanks
0
 

Author Comment

by:enrique_aeo
ID: 35194088
kaufmed: is a code that is already done
IJZ: everything I do in the code behind

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Expert Comment

by:Imran Javed Zia
ID: 35194103
then make sure that
ddlDepartamento.SelectedItem!=null
or ddlDepartamento.SelectedIndex>0
0
 
LVL 16

Accepted Solution

by:
Imran Javed Zia earned 250 total points
ID: 35194112
I think you are using vb.net then use
ddlDepartamento.SelectedItem<>Nothing
or
ddlDepartamento.SelectedIndex>0
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 35194132
>>  kaufmed: is a code that is already done

I mean are you calling it in Form_Load, OnFormLoad, OnLoadComplete, etc.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Not showing page correctly 3 31
SQL Login 17 40
Error in JQuery 5 39
ASP.NET - Bind Gridview Datasource to a specific table in dataset 3 18
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

862 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now