472,378 Members | 1,140 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 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 3982
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...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.