Link to home
Start Free TrialLog in
Avatar of Tom Knowlton
Tom KnowltonFlag for United States of America

asked on

error trying to go to page 2

The information in the gridview displays fine, but when I try to go to page 2 I get an error:

User generated image

Here are the error details:

System.NullReferenceException was unhandled by user code
  Message=Object reference not set to an instance of an object.
  Source=Framework
  StackTrace:
       at Framework.Utilities.ExceptionManager.LogException(Exception ex) in C:\R13\Framework\Utilities\ExceptionManager.cs:line 16
       at Reo.Global.Application_Error(Object sender, EventArgs e) in C:\R13\Reo\Global.asax.cs:line 65
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Web.HttpApplication.RaiseOnError()
  InnerException: 

Open in new window

Avatar of Tom Knowlton
Tom Knowlton
Flag of United States of America image

ASKER

More info:

Message      "The GridView 'gvPendingRepairBids' fired event PageIndexChanging which wasn't handled."      string


Assuming I handle the event as suggested...what would I put inside it?

Or do I leave the event empty?
ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

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
For some reason it thinks it is needed.


But yeah, I have it fixed now:


     protected void gvPendingRepairBids_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            SetPendingRepairsGridData(e.NewPageIndex);            
        }

        private void SetPendingRepairsGridData(int pageindex)
        {
            int atid = AssetTask.AssetUnitID;
            int atsid = AssetTask.AssetUnitSID;

            using (MarketingDataContext dc2 = new MarketingDataContext())
            {
                this.gvPendingRepairBids.PageIndex = pageindex;
                _pendingRepairBids = dc2.Marketing_Plan_PendingRepairBids_Get(atid, atsid).ToList<Marketing_Plan_PendingRepairBids_GetResult>();
                this.gvPendingRepairBids.DataSource = _pendingRepairBids;
                this.gvPendingRepairBids.DataBind();
            }
        }

Open in new window

Thanks guru_sami.

You are 2 for 2 today on my questions, a perfect record!
Glad it's helping :)
It is.

I don't know what other software developers are like, but it does not come as "easily" to me as to some others I have observed.  I know what things I've done and I know what is possible, but can never seem to get it to STICK in my brain.  Sigh.

So, I really appreciate a second pair of eyes.  : )