Tricky Question: Page_Load

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Tricky Question: Page_Load

    I have a usercontrol that sets a public/shared variable called
    "database_name". (User selects a dropdownlist of available databases.) A
    webform (webform1), that uses this usercontrol, connects to the database
    defined by that public variable and does stuff.

    Problem: Webform1 is always one database "behind". This is because the
    Page_Load runs on webform1, THEN Page_Load is run on the usercontrol (which
    sets the database_name variable).

    Any ideas how I can fix this/compensate?

    Please assist.

    Thanks,
    Robert


    VB Programmer Guest

  2. Similar Questions and Discussions

    1. Page_Load called more than once for user control - newbie question
      Hi, I have a page with a user control as header, which in turn has a user control drop down list. When I run the page in debug with a break on...
    2. it's tricky!
      hello, hoping there's a easy solution to this...i am making an html page in dreamweaver and i have an animated flash character in the corner. this...
    3. Tricky Recordset Question: HELP!
      I'm not sure where your problem is. You describe some things you've tried, but you don't explain what goes wrong when you try them ... I think we...
    4. A tricky one?
      Hi, I wonder if anyone can help me with this? Using A2K, I have a continuous form, which is constantly requeried every 10 seconds using the timer...
    5. Tricky Dynamic SQL question
      Im new to this project and its in rapid development so there is little or no documentation so please bare with me. We have supertype tables that...
  3. #2

    Default Re: Tricky Question: Page_Load

    You don't want to put any actually "processing" functionality into page
    load. You should be doing any processing in an event such as a click, that
    way all controls (both user and asp) have a chance to run their load event.
    The data for the controls in the page_load isn't guaranteed to be up to
    date.

    HTH,

    bill



    "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
    news:uSt4$czPDHA.1584@TK2MSFTNGP11.phx.gbl...
    > I have a usercontrol that sets a public/shared variable called
    > "database_name". (User selects a dropdownlist of available databases.) A
    > webform (webform1), that uses this usercontrol, connects to the database
    > defined by that public variable and does stuff.
    >
    > Problem: Webform1 is always one database "behind". This is because the
    > Page_Load runs on webform1, THEN Page_Load is run on the usercontrol
    (which
    > sets the database_name variable).
    >
    > Any ideas how I can fix this/compensate?
    >
    > Please assist.
    >
    > Thanks,
    > Robert
    >
    >

    William F. Robertson, Jr. Guest

  4. #3

    Default Re: Tricky Question: Page_Load

    You could take the code out of page_load and put it into page_prerender.
    Then it will run after all your controls preload

    "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
    news:uSt4$czPDHA.1584@TK2MSFTNGP11.phx.gbl...
    > I have a usercontrol that sets a public/shared variable called
    > "database_name". (User selects a dropdownlist of available databases.) A
    > webform (webform1), that uses this usercontrol, connects to the database
    > defined by that public variable and does stuff.
    >
    > Problem: Webform1 is always one database "behind". This is because the
    > Page_Load runs on webform1, THEN Page_Load is run on the usercontrol
    (which
    > sets the database_name variable).
    >
    > Any ideas how I can fix this/compensate?
    >
    > Please assist.
    >
    > Thanks,
    > Robert
    >
    >

    charles Guest

  5. #4

    Default Re: Tricky Question: Page_Load

    This worked GREAT! Thanks!

    "charles" <charles@synthigence.com> wrote in message
    news:eRriy3zPDHA.3664@tk2msftngp13.phx.gbl...
    > You could take the code out of page_load and put it into page_prerender.
    > Then it will run after all your controls preload
    >
    > "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
    > news:uSt4$czPDHA.1584@TK2MSFTNGP11.phx.gbl...
    > > I have a usercontrol that sets a public/shared variable called
    > > "database_name". (User selects a dropdownlist of available databases.)
    A
    > > webform (webform1), that uses this usercontrol, connects to the database
    > > defined by that public variable and does stuff.
    > >
    > > Problem: Webform1 is always one database "behind". This is because the
    > > Page_Load runs on webform1, THEN Page_Load is run on the usercontrol
    > (which
    > > sets the database_name variable).
    > >
    > > Any ideas how I can fix this/compensate?
    > >
    > > Please assist.
    > >
    > > Thanks,
    > > Robert
    > >
    > >
    >
    >

    VB Programmer Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139