473,324 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Triggering both client and server side scripts


I have a button that opens a new Window using client side Javascript. The
button also has server side script (.._click) that saves some session
variables to be used in the new Window.

The problem is that the server side function does not fire.

Karim
Nov 18 '05 #1
3 1921
Hi Karim,

Here's some code that might work for you. Not sure whether the setting of
the Session variable will be done in time for the secondary window to fetch.
Depends on the speed of the server, I suppose.

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add _
("onclick", "window.open('sec.aspx','sec');return true;")
End Sub

Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Session("stored") = "here is the value at " & _
Now.ToLongTimeString
End Sub

"Karim" <ka*******@yahoo.moc> wrote in message
news:96****************************@40tude.net...

I have a button that opens a new Window using client side Javascript. The
button also has server side script (.._click) that saves some session
variables to be used in the new Window.

The problem is that the server side function does not fire.

Karim

Nov 18 '05 #2
On Tue, 25 Nov 2003 21:34:41 -0500, Ken Cox [Microsoft MVP] wrote:
Hi Karim,

Here's some code that might work for you. Not sure whether the setting of
the Session variable will be done in time for the secondary window to fetch.
Depends on the speed of the server, I suppose.

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add _
("onclick", "window.open('sec.aspx','sec');return true;")
End Sub

Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Session("stored") = "here is the value at " & _
Now.ToLongTimeString
End Sub

Thanks. Your code resembles what I have. The problem is that the button
click doesn't fire. I want to execute code in the click event first to set
the session variables, then open window fires up to open a new window whose
page_load event reads in the session variables that were set by the
parent's window. I guess I will have to send the parameters through a
querystring which will will built dynamically in the open window script.
The variables are some form fields.

Does anyone have a better way of doing this?

Karim


"Karim" <ka*******@yahoo.moc> wrote in message
news:96****************************@40tude.net...

I have a button that opens a new Window using client side Javascript. The
button also has server side script (.._click) that saves some session
variables to be used in the new Window.

The problem is that the server side function does not fire.

Karim

Nov 18 '05 #3
On Wed, 26 Nov 2003 08:05:28 -0800, Karim wrote:
On Tue, 25 Nov 2003 21:34:41 -0500, Ken Cox [Microsoft MVP] wrote:
Hi Karim,

Here's some code that might work for you. Not sure whether the setting of
the Session variable will be done in time for the secondary window to fetch.
Depends on the speed of the server, I suppose.

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add _
("onclick", "window.open('sec.aspx','sec');return true;")
End Sub

Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Session("stored") = "here is the value at " & _
Now.ToLongTimeString
End Sub

Thanks. Your code resembles what I have. The problem is that the button
click doesn't fire. I want to execute code in the click event first to set
the session variables, then open window fires up to open a new window whose
page_load event reads in the session variables that were set by the
parent's window. I guess I will have to send the parameters through a
querystring which will will built dynamically in the open window script.
The variables are some form fields.

Does anyone have a better way of doing this?

Karim


"Karim" <ka*******@yahoo.moc> wrote in message
news:96****************************@40tude.net...

I have a button that opens a new Window using client side Javascript. The
button also has server side script (.._click) that saves some session
variables to be used in the new Window.

The problem is that the server side function does not fire.


Well now after many tries I found that the click does fire sometimes. It
sometimes gets fired before the new Window is opened, sometimes gets fired
after the new Window is opened and sometimes the click event never fires.
This is very inconsistent!

Karim
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Kathryn | last post by:
Hiya I have a problem with using some client side and server side scripting together in an ASP. I'm using VBScript. What I'm trying to achieve is this - - Page loads up and some server side...
2
by: Stephanie Stowe | last post by:
Hi. I have never worked on a project that requires IE. So I have done the vast majority of my work server side, delivering cross-browser compliant HTML to the client. I am working on a bug fix to a...
5
by: tmb | last post by:
Is there a way to use ASP to 'push' a new image to the client every 15 seconds or so? I guess the entire page will have to be 're-sent' to the client but I'm not sure. I'm trying to 'rotate'...
5
by: Mong | last post by:
Hi, I have a webform with various asp controls on it such as textboxes and dropdownlists. I'm fairly new to asp.net coming from VB6 and am wondering when it's best to use client side events and...
6
by: adolf garlic | last post by:
A postback I'm doing takes ages to get the data which it then uses to populate a table. What I want to know is: How can I get the client side to fire a 'resize' event when the postback thing...
4
by: Tarllem | last post by:
Hi! Is possible to run scripts at the side of the client? Thanks!
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
10
by: Ben | last post by:
Hi, I made an application in classic asp (reservation of books and video stuffs for students) and want to migrate to asp.net. The user has to chose a date, then pushung on a submit button. The...
5
by: Ankur | last post by:
Hi Folks, I am new for this group. I want to clarify one thing what's a basic difference between Client Side Java Script and Server Side Java Script. how we can differentiate it. Why we called...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.