Link to home
Start Free TrialLog in
Avatar of Tammu
Tammu

asked on

What does this error mean in asp.net 2.0 and C#

My site is built in ASP.NET 2.0 and C# using SQL 2005 Database. I am writing all the error to my db in table called Exceptions.

Lately I have noticed that on my Products page, this error keeps getting written to the Exception table a lot. And I am not able to replicate it, if I want to check it out.

 System.NullReferenceException: Object reference not set to an instance of an object. at MySite.products.showItems(Int32 pageIndex) in c:\Websites\gn4f4ada\browse\products.aspx.cs:line 547 at MySite.products.Page_Load(Object sender, EventArgs e) in c:\Websites\gn4f4ada\browse\products.aspx.cs:line 68

Open in new window


in products.aspx.cs line 68 is

   try
            {
                if (!this.IsPostBack)
                {
                    this.CategoryId = Convert.ToInt32(Request[REQ_CATEGORY_ID]);
                    this.showItems(this.PageIndex);  // THIS IS LINE 68
                }
            }
            catch (Exception ex)
            {
                this.HandlePageError(ex);
            }

Open in new window


and line 547

     private void showItems(int pageIndex)
        {
            Category view;
            if (SelectedSize > -1)
            {
                view = this.CurrentCategory.GetView(
                    (SizeType)SelectedSize,
                    (Gender)SelectedGender);
            }
            else
            {
                if (SelectedGender > 0)
                {
                    view = this.CurrentCategory.GetView((Gender)SelectedGender);
                }
                else
                {
                    view = this.CurrentCategory;
                }
            }

            this.pager.SetPagingLabels(view.ItemCount);  // THIS IS LINE 547

            if (this.ViewMode == MySitePage.ViewMode.Paged)
            {
                this.rProducts.DataSource = view.GetPage(pageIndex, this.pager.PageSize);
            }
            else
            {
                this.rProducts.DataSource = view.Items;
            }
            this.rProducts.DataBind();
        }

Open in new window


any advice or suggestions are appreciated
Avatar of kaufmed
kaufmed
Flag of United States of America image

Is either pager or view null at the point the exception is raised? Have you tried stepping through your code?
ASKER CERTIFIED SOLUTION
Avatar of Rainverse
Rainverse

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tammu
Tammu

ASKER

The problem is I am not able to replicate it. It only shows up in the Exception Table
That's because you're doing error handling.
Avatar of Tammu

ASKER

Thanks