473,395 Members | 1,938 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,395 software developers and data experts.

Execute Javascript AFTER click event

Hi All,
I have an .net form that is split into two frames. The left frame has a
tree that displays a list of all the customers. The right frame displays
the appropriate clients information. When the save button is pressed on the
right frame, I want to update the tree in the left frame AFTER saving all
the data as the changes to the right frame may affect how the tree is
displayed. I tried using the following:

btnSave.Attributes("onclick") = "top.frames['search'].location.href =
'SearchTree.aspx';"

The only issue is that the above javascript executes BEFORE the server side
click event. So what I need to be able to do is either

1) call a javascript from vb.net whenever I want OR
2) without javascript, refresh a frame from another frame OR
3) somehow have the clientside script execute AFTER the serverside
script
Any help, with examples, would be greatly appreciated.

Thanks
Ian
Nov 19 '05 #1
4 4047
Ian,

3) is the way to go. Make a hidden input for passing instructions from
server to client. Make a client-side <body .. onload=..> event that will
read the input and handle the instruction if any. Normally, the input will
be empty. When you want to tell the client to update the tree, pass a word
"UPDATETREE". The client side onload event will get the word and execute
top.frames['search'].location.href = 'SearchTree.aspx';

Eliyahu

"Ian Kelly" <in**@thetawave.on.ca> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi All,
I have an .net form that is split into two frames. The left frame has a
tree that displays a list of all the customers. The right frame displays
the appropriate clients information. When the save button is pressed on the right frame, I want to update the tree in the left frame AFTER saving all
the data as the changes to the right frame may affect how the tree is
displayed. I tried using the following:

btnSave.Attributes("onclick") = "top.frames['search'].location.href =
'SearchTree.aspx';"

The only issue is that the above javascript executes BEFORE the server side click event. So what I need to be able to do is either

1) call a javascript from vb.net whenever I want OR
2) without javascript, refresh a frame from another frame OR
3) somehow have the clientside script execute AFTER the serverside
script
Any help, with examples, would be greatly appreciated.

Thanks
Ian

Nov 19 '05 #2
Hi Eliyahu,
Thanks for your suggestion. I should have given some info on my background.
I am a VB 6.0 programmer. VB.NET is very new to me. I think I got most of
what you were suggesting, but could I get some more detail. Sorry.

Ian
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Ian,

3) is the way to go. Make a hidden input for passing instructions from
server to client. Make a client-side <body .. onload=..> event that will
read the input and handle the instruction if any. Normally, the input will
be empty. When you want to tell the client to update the tree, pass a word
"UPDATETREE". The client side onload event will get the word and execute
top.frames['search'].location.href = 'SearchTree.aspx';

Eliyahu

"Ian Kelly" <in**@thetawave.on.ca> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi All,
I have an .net form that is split into two frames. The left frame has a
tree that displays a list of all the customers. The right frame displays
the appropriate clients information. When the save button is pressed on

the
right frame, I want to update the tree in the left frame AFTER saving all
the data as the changes to the right frame may affect how the tree is
displayed. I tried using the following:

btnSave.Attributes("onclick") = "top.frames['search'].location.href =
'SearchTree.aspx';"

The only issue is that the above javascript executes BEFORE the server

side
click event. So what I need to be able to do is either

1) call a javascript from vb.net whenever I want OR
2) without javascript, refresh a frame from another frame OR
3) somehow have the clientside script execute AFTER the serverside
script
Any help, with examples, would be greatly appreciated.

Thanks
Ian


Nov 19 '05 #3
Ian,

Put in your .aspx file just before the </form> tag a line:
<input type=hidden id=inhAction runat=server>
Here you will pass action instructions from server to client.
After switching to design view and back to html view it will add a
HtmlInputHidden control named inhAction to yoour code behind.

In the Page_Load server event put a line:
inhAction.Value=""
This will preset the action to empty string.

At the end of your server-side event that handles the save button click put
a line:
inhAction.Value="UPDATETREE"

Go back to the .aspx page and make your <body> looking as
<body onload="handleAction()">

In the <head> section of the .aspx page add a javascript::
<script language="javascript">
function handleAction(){
if (Form1.inhAction.value=="UPDATETREE")
top.frames['search'].location.href = 'SearchTree.aspx';
}
</script>

That's about it.

Eliyahu

"Ian Kelly" <in**@thetawave.on.ca> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
Hi Eliyahu,
Thanks for your suggestion. I should have given some info on my background. I am a VB 6.0 programmer. VB.NET is very new to me. I think I got most of what you were suggesting, but could I get some more detail. Sorry.

Ian
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Ian,

3) is the way to go. Make a hidden input for passing instructions from
server to client. Make a client-side <body .. onload=..> event that will
read the input and handle the instruction if any. Normally, the input will be empty. When you want to tell the client to update the tree, pass a word "UPDATETREE". The client side onload event will get the word and execute
top.frames['search'].location.href = 'SearchTree.aspx';

Eliyahu

"Ian Kelly" <in**@thetawave.on.ca> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi All,
I have an .net form that is split into two frames. The left frame has a tree that displays a list of all the customers. The right frame displays the appropriate clients information. When the save button is pressed on
the
right frame, I want to update the tree in the left frame AFTER saving

all the data as the changes to the right frame may affect how the tree is
displayed. I tried using the following:

btnSave.Attributes("onclick") = "top.frames['search'].location.href =
'SearchTree.aspx';"

The only issue is that the above javascript executes BEFORE the server

side
click event. So what I need to be able to do is either

1) call a javascript from vb.net whenever I want OR
2) without javascript, refresh a frame from another frame OR
3) somehow have the clientside script execute AFTER the serverside script
Any help, with examples, would be greatly appreciated.

Thanks
Ian



Nov 19 '05 #4
Eliyahu,
I just got in and tried this. It works VERY well.

Thank you very much.

Ian
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:Ob**************@tk2msftngp13.phx.gbl...
Ian,

Put in your .aspx file just before the </form> tag a line:
<input type=hidden id=inhAction runat=server>
Here you will pass action instructions from server to client.
After switching to design view and back to html view it will add a
HtmlInputHidden control named inhAction to yoour code behind.

In the Page_Load server event put a line:
inhAction.Value=""
This will preset the action to empty string.

At the end of your server-side event that handles the save button click
put
a line:
inhAction.Value="UPDATETREE"

Go back to the .aspx page and make your <body> looking as
<body onload="handleAction()">

In the <head> section of the .aspx page add a javascript::
<script language="javascript">
function handleAction(){
if (Form1.inhAction.value=="UPDATETREE")
top.frames['search'].location.href = 'SearchTree.aspx';
}
</script>

That's about it.

Eliyahu

"Ian Kelly" <in**@thetawave.on.ca> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
Hi Eliyahu,
Thanks for your suggestion. I should have given some info on my

background.
I am a VB 6.0 programmer. VB.NET is very new to me. I think I got most

of
what you were suggesting, but could I get some more detail. Sorry.

Ian
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> Ian,
>
> 3) is the way to go. Make a hidden input for passing instructions from
> server to client. Make a client-side <body .. onload=..> event that
> will
> read the input and handle the instruction if any. Normally, the input will > be empty. When you want to tell the client to update the tree, pass a word > "UPDATETREE". The client side onload event will get the word and
> execute
> top.frames['search'].location.href = 'SearchTree.aspx';
>
> Eliyahu
>
> "Ian Kelly" <in**@thetawave.on.ca> wrote in message
> news:%2****************@TK2MSFTNGP09.phx.gbl...
>> Hi All,
>> I have an .net form that is split into two frames. The left frame has a >> tree that displays a list of all the customers. The right frame displays >> the appropriate clients information. When the save button is pressed on > the
>> right frame, I want to update the tree in the left frame AFTER saving all >> the data as the changes to the right frame may affect how the tree is
>> displayed. I tried using the following:
>>
>> btnSave.Attributes("onclick") = "top.frames['search'].location.href =
>> 'SearchTree.aspx';"
>>
>> The only issue is that the above javascript executes BEFORE the server
> side
>> click event. So what I need to be able to do is either
>>
>> 1) call a javascript from vb.net whenever I want OR
>> 2) without javascript, refresh a frame from another frame OR
>> 3) somehow have the clientside script execute AFTER the serverside >> script
>>
>>
>> Any help, with examples, would be greatly appreciated.
>>
>> Thanks
>> Ian
>>
>>
>
>



Nov 19 '05 #5

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

Similar topics

6
by: Jon | last post by:
Hello, I have a datagrid and the data in it is dynamically created at runtime... For iCounter = 0 To dataset.Tables(0).Columns.Count - 1 Dim objbc As New BoundColumn() With objbc .DataField...
2
by: Dave | last post by:
Hi, I have a datagrid with a Templated column below. I want to execute some javascript before the postback to show a hidden "div" tag with static message of "Please Wait..." since the query takes...
5
by: Scott Natwick | last post by:
Is there a way to execute a JavaScript from the Page_Load event? Or alternatively, is there a way to have it execute when the page is loaded? I am defining the script in the Page_Load event and...
4
by: Mark Miller | last post by:
I've been trying to execute a javascript function just before submit on a form that contains an <input type="file"> input field and it isn't working. The reason I want to do this is the end users...
1
by: Eduardo78 | last post by:
I am working on a web application, my first one, I used to program windows app. and the form had an property where i could set a key to be de default to execute a botton click event. But now I...
6
by: simon | last post by:
hello, what code would i use to kick off a javascript script after i had registered it? If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then Page.RegisterClientScriptBlock("jsScript",...
4
by: j1dopeman | last post by:
Hi, I'd like to use a button to save and then submit a form. I can set the onlick of the button to mahButton_click or submit, but I can't figure out how to do both. It looks like c# can't...
7
by: Peter | last post by:
I have a HoverMenuExtender which contains an asp:PlaceHolder, this place holder has a User Control and this control contrains a Button. The problem I am having is after the button fires the click...
7
by: btreddy | last post by:
Hii all , desperately looking for help. i want to execute one java script function,passvalues(), which is there in my master page. After doing so much of additions , subtraction and type...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.