Page Load Phasing

Discussion in 'ASP .Net' started by Gary Coutts, Mar 18, 2006.

  1. Gary Coutts

    Gary Coutts Guest

    Hi,

    I am generating a popup window for data entry using the javascript
    window.open function:

    window.open('ViewItem.aspx', Index, WindowSetUp) ;

    I need to generate some controls dynamically in ViewItem.aspx, the type of
    controls generated are dependant on Index.

    I need to pass the Index value to ViewItem.aspx and I am using a hidden
    control (hCatIndex) and small java function to store the info:


    function PassData()
    {
    var CatIndex ;

    CatIndex = document.getElementById("hCatIndex") ;
    CatIndex.value = window.dialogArguments ;
    }

    PassData() is run when the page is loaded, the problem is that the script is
    run after the Page_Load() of ViewItem and I need the info before this.

    Can I get the script (PassData) to run before Page_Load ?

    Is this a valid way to pass data between Client and Server or is there a
    better way.


    I am using Visual Studio .Net 2003.


    Any ideas or comments would be most appreciated.


    Best Regards

    Gary Coutts
     
    Gary Coutts, Mar 18, 2006
    #1
    1. Advertising

  2. Hi Gary,

    Normally, Session or Cookie is used to transfer (share) data between pages.

    And it’s impossible to run javascript code before Page_Load. javascript
    runs on client-side. Page_Load event is on server-side. Only after all
    server–side event, page is rendered on client-side, then there are chances to
    run javascript code.


    HTH

    Elton Wang

    "Gary Coutts" wrote:

    > Hi,
    >
    > I am generating a popup window for data entry using the javascript
    > window.open function:
    >
    > window.open('ViewItem.aspx', Index, WindowSetUp) ;
    >
    > I need to generate some controls dynamically in ViewItem.aspx, the type of
    > controls generated are dependant on Index.
    >
    > I need to pass the Index value to ViewItem.aspx and I am using a hidden
    > control (hCatIndex) and small java function to store the info:
    >
    >
    > function PassData()
    > {
    > var CatIndex ;
    >
    > CatIndex = document.getElementById("hCatIndex") ;
    > CatIndex.value = window.dialogArguments ;
    > }
    >
    > PassData() is run when the page is loaded, the problem is that the script is
    > run after the Page_Load() of ViewItem and I need the info before this.
    >
    > Can I get the script (PassData) to run before Page_Load ?
    >
    > Is this a valid way to pass data between Client and Server or is there a
    > better way.
    >
    >
    > I am using Visual Studio .Net 2003.
    >
    >
    > Any ideas or comments would be most appreciated.
    >
    >
    > Best Regards
    >
    > Gary Coutts
    >
    >
    >
    >
     
    =?Utf-8?B?RWx0b24gVw==?=, Mar 19, 2006
    #2
    1. Advertising

  3. How about just passing the variable as a querystring parameters.

    window.open('ViewItem.aspx?'+Index, Index, WindowSetup);

    Or something like the above.

    "Gary Coutts" <> wrote in message
    news:%...
    > Hi,
    >
    > I am generating a popup window for data entry using the javascript
    > window.open function:
    >
    > window.open('ViewItem.aspx', Index, WindowSetUp) ;
    >
    > I need to generate some controls dynamically in ViewItem.aspx, the type of
    > controls generated are dependant on Index.
    >
    > I need to pass the Index value to ViewItem.aspx and I am using a hidden
    > control (hCatIndex) and small java function to store the info:
    >
    >
    > function PassData()
    > {
    > var CatIndex ;
    >
    > CatIndex = document.getElementById("hCatIndex") ;
    > CatIndex.value = window.dialogArguments ;
    > }
    >
    > PassData() is run when the page is loaded, the problem is that the script
    > is
    > run after the Page_Load() of ViewItem and I need the info before this.
    >
    > Can I get the script (PassData) to run before Page_Load ?
    >
    > Is this a valid way to pass data between Client and Server or is there a
    > better way.
    >
    >
    > I am using Visual Studio .Net 2003.
    >
    >
    > Any ideas or comments would be most appreciated.
    >
    >
    > Best Regards
    >
    > Gary Coutts
    >
    >
    >
     
    Peter Rilling, Mar 20, 2006
    #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. Lauren Wilson
    Replies:
    2
    Views:
    2,049
    Mary Chipman [MSFT]
    May 9, 2005
  2. venky

    Page Load and webcontrol page load

    venky, Jul 6, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    3,120
    venky
    Jul 11, 2005
  3. Matcon
    Replies:
    3
    Views:
    21,601
    Matcon
    May 28, 2008
  4. Kaushik Dutta

    phasing out asp support

    Kaushik Dutta, Dec 26, 2003, in forum: ASP General
    Replies:
    9
    Views:
    255
    Jeff Cochran
    Jan 22, 2004
  5. zoat
    Replies:
    0
    Views:
    102
Loading...

Share This Page