Page Load Phasing

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
 
G

Guest

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
 
P

Peter Rilling

How about just passing the variable as a querystring parameters.

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

Or something like the above.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top