Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 522
  • Last Modified:

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

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
enrique_aeo
Asked:
enrique_aeo
  • 3
  • 2
1 Solution
 
käµfm³d 👽Commented:
What function/method are you calling If ddlDepartamento.SelectedItem.Value.Equals("%") Then in?
0
 
Imran Javed ZiaConsultant Software Engineer - .NET ArchitectCommented:
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
 
enrique_aeoAuthor Commented:
kaufmed: is a code that is already done
IJZ: everything I do in the code behind

0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
Imran Javed ZiaConsultant Software Engineer - .NET ArchitectCommented:
then make sure that
ddlDepartamento.SelectedItem!=null
or ddlDepartamento.SelectedIndex>0
0
 
Imran Javed ZiaConsultant Software Engineer - .NET ArchitectCommented:
I think you are using vb.net then use
ddlDepartamento.SelectedItem<>Nothing
or
ddlDepartamento.SelectedIndex>0
0
 
käµfm³d 👽Commented:
>>  kaufmed: is a code that is already done

I mean are you calling it in Form_Load, OnFormLoad, OnLoadComplete, etc.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now