Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8181807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:38:52+00:00 2026-06-07T00:38:52+00:00

I keep getting this error and have no idea why. I googled and scanned

  • 0

I keep getting this error and have no idea why. I googled and scanned the asp.net site for two days now so I need some help. The error is:

Object reference not set to an instance of an object

Here’s my code:

DropDownList DropDownList1 =(DropDownList)ListView1.InsertItem.FindControl("DropDownList1");

string highToLow = DropDownList1.SelectedValue;
string lowToHigh = DropDownList1.SelectedValue;

if (highToLow == "1")
{
    var exmapleFilter = from users in testEntities.users 
                        orderby users.id descending
                        select users;

    ListView1.DataBind();
}

I have the value of the drop down set to 1 for high and 2 for low, and on selected index changed I want to run the ADO.net Entity Framework code to return a sorted list of data.

I’m currently using a linq data source and a list view to show what’s in my database.

Thanks.

EDIT:

Here is the stack trace

   System.NullReferenceException was unhandled by user code
   Message=Object reference not set to an instance of an object.
   Source=App_Web_s0ked5y3

   StackTrace:
   at Default.DropDownList1_SelectedIndexChanged(Object sender, EventArgs e)
   in Default:line 120

   at System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e)

   at System.Web.UI.WebControls.DropDownList.RaisePostDataChangedEvent()

   at System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.
   RaisePostDataChangedEvent()

   at System.Web.UI.Page.RaiseChangedEvents()

   at System.Web.UI.Page.ProcessRequestMain(Boolean 
   includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   InnerException: 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:38:54+00:00Added an answer on June 7, 2026 at 12:38 am

    Check that you have in your list view

    <InsertItemTemplate>
       ....          
       <asp:DropDownList ID="DropDownList1" runat="server" />
       .... 
    

    In association with

    ListView1.InsertItem.FindControl("DropDownList1");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this error from my code and I have no idea what
I am keep getting this error while uploading..I have no idea what this error
I keep getting this error and I have tried putting quotes around the actual
I keep getting this error all over the place where I only have jquery
I keep getting this error and I really dont know why. I have tried
i have this php code and keep on getting errors upon fixing each error.
I keep getting this error: MySQL said: #1064 - You have an error in
I keep randomly getting this error within my Drupal site. Only way to resolve
Keep getting this error after inserting a subdatasheet into a query and trying to
I keep getting this error System.Web.HttpException was unhandled by user code Message=Validation of viewstate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.