Solved

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

Posted on 2011-03-22
6
507 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 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