Desperate repost: Reloading page too quickly results in an error

Discussion in 'ASP .Net' started by Walter, Dec 20, 2003.

  1. Walter

    Walter Guest

    Each of the aspx pages in my application have a User Control called
    "WrapStart".

    In a page's Page_Load() method, I set various properties and/or call
    various methods of the WrapStart control object. Everything works
    fine... except...

    ....when I click too quickly from one page to another (or quickly
    reload the same page). When I do, I get the following error:

    "Object reference not set to an instance of an object."

    And the line highlighted in the error is: WrapStart.someMethod();


    I'm wondering what is going on and how do I fix this problem. Any
    help would be greatly appreciated.
    Walter, Dec 20, 2003
    #1
    1. Advertising

  2. Walter

    Hermit Dave Guest

    Have you tried setting the user control as an data member within your
    derived class (ie the custom page)
    or are you relying on Page.FindControl to get its instance ?

    I think declaring it as a data member should ease the problem cause it will
    be initialised and bound correctly in the constructor

    public class CA_ShowProductStock : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.LinkButton lnkBack;
    protected System.Web.UI.WebControls.DataGrid DataGrid1;
    protected WebShop.ShopAdmin.Label ModuleTitle1;

    The html view on the aspx file has the user control id as ModuleTitle1.
    Let us know how you get on with it...

    Hope this helps,

    HD


    "Walter" <> wrote in message
    news:6j4Fb.26506$...
    > Each of the aspx pages in my application have a User Control called
    > "WrapStart".
    >
    > In a page's Page_Load() method, I set various properties and/or call
    > various methods of the WrapStart control object. Everything works
    > fine... except...
    >
    > ...when I click too quickly from one page to another (or quickly
    > reload the same page). When I do, I get the following error:
    >
    > "Object reference not set to an instance of an object."
    >
    > And the line highlighted in the error is: WrapStart.someMethod();
    >
    >
    > I'm wondering what is going on and how do I fix this problem. Any
    > help would be greatly appreciated.
    >
    >
    Hermit Dave, Dec 21, 2003
    #2
    1. Advertising

  3. Walter

    Walter Guest

    This is the way it already is accessed.

    "Hermit Dave" <> wrote in message
    news:...
    > Have you tried setting the user control as an data member within your
    > derived class (ie the custom page)
    > or are you relying on Page.FindControl to get its instance ?
    >
    > I think declaring it as a data member should ease the problem cause it

    will
    > be initialised and bound correctly in the constructor
    >
    > public class CA_ShowProductStock : System.Web.UI.Page
    > {
    > protected System.Web.UI.WebControls.LinkButton lnkBack;
    > protected System.Web.UI.WebControls.DataGrid DataGrid1;
    > protected WebShop.ShopAdmin.Label ModuleTitle1;
    >
    > The html view on the aspx file has the user control id as ModuleTitle1.
    > Let us know how you get on with it...
    >
    > Hope this helps,
    >
    > HD
    >
    >
    > "Walter" <> wrote in message
    > news:6j4Fb.26506$...
    > > Each of the aspx pages in my application have a User Control called
    > > "WrapStart".
    > >
    > > In a page's Page_Load() method, I set various properties and/or call
    > > various methods of the WrapStart control object. Everything works
    > > fine... except...
    > >
    > > ...when I click too quickly from one page to another (or quickly
    > > reload the same page). When I do, I get the following error:
    > >
    > > "Object reference not set to an instance of an object."
    > >
    > > And the line highlighted in the error is: WrapStart.someMethod();
    > >
    > >
    > > I'm wondering what is going on and how do I fix this problem. Any
    > > help would be greatly appreciated.
    > >
    > >

    >
    >
    Walter, Dec 22, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QUNhdW50ZXI=?=

    session variable expire too quickly

    =?Utf-8?B?QUNhdW50ZXI=?=, Jan 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    529
    Curt_C [MVP]
    Jan 13, 2005
  2. Replies:
    3
    Views:
    8,155
    Juan T. Llibre
    Jun 28, 2005
  3. Terry  Heath

    tabstrip changing pages too quickly

    Terry Heath, Jul 14, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    110
    Terry Heath
    Jul 14, 2005
  4. dw

    ASP sessions end too quickly

    dw, Nov 15, 2004, in forum: ASP General
    Replies:
    3
    Views:
    150
    Jeff Dillon
    Nov 16, 2004
  5. nic den
    Replies:
    0
    Views:
    97
    nic den
    Jul 30, 2003
Loading...

Share This Page