Page Load Phasing

  • Thread starter Thread starter Gary Coutts
  • Start date Start date
G

Gary Coutts

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
 
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
 
How about just passing the variable as a querystring parameters.

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

Or something like the above.
 
Back
Top