Solved

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

Posted on 2011-03-22
6
509 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
[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
  • 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
Technology Partners: 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!

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Technology Resume 7 67
Name Space error VS2015 1 35
using CK editor in iframes 5 26
Using/Import statement in code doesn't see reference of dll just added. 3 26
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

735 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