Hi all,
Is there some intelligent way to trigger a clientside JavaScript function
before a postback is triggerd by any of the controls on a page?
Thanks in advance,
Michel Mathijssen 7 2934
Michel wrote: Is there some intelligent way to trigger a clientside JavaScript function before a postback is triggerd by any of the controls on a page?
Use the document.onunload event. This event is invoked before the page
is posted back.
Anders Norås http://dotnetjunkies.com/weblog/anoras/
However, this event also happens when the user navigates to a different
page, even if it is just by typing in a different we address. It also
occurrs when the user closes the browser window. There is no way to tell the
difference as to why the event is running.
"Anders Norås [MCAD]" <an**********@objectware.no> wrote in message
news:OL****************@TK2MSFTNGP15.phx.gbl... Michel wrote: Is there some intelligent way to trigger a clientside JavaScript
function before a postback is triggerd by any of the controls on a page? Use the document.onunload event. This event is invoked before the page is posted back.
Anders Norås http://dotnetjunkies.com/weblog/anoras/
Hi, Thanks for the idea, it was very promissing, and I thought it surely
would solve my problem. But:
What I need to do is select entries al the items from a selectbox, which has
changed on the clientsite. This entries needs to be submitted together with
all the other form information. When I put this script in the onUnload event
of the body, it did select the needed data, but it is not added to the form
data posted back to the server. (Probably because the data to post is
allready gathered, and maybe even sent back, when the onUnload event occures.)
I also tried to put it in the onsubmit event of the form. (alert('test');
but the code generated contained "if (!ValidatorOnSubmit()) return false;
alert('test');", and the alert was never executed, although there is no
invallid data on the page.
Is their another way to execute a Javascript function before the postback is
done?
Thanks in advance,
Michel
"Marina" wrote: However, this event also happens when the user navigates to a different page, even if it is just by typing in a different we address. It also occurrs when the user closes the browser window. There is no way to tell the difference as to why the event is running.
"Anders Norås [MCAD]" <an**********@objectware.no> wrote in message news:OL****************@TK2MSFTNGP15.phx.gbl... Michel wrote: Is there some intelligent way to trigger a clientside JavaScript function before a postback is triggerd by any of the controls on a page? Use the document.onunload event. This event is invoked before the page is posted back.
Anders Norås http://dotnetjunkies.com/weblog/anoras/
have you tried the this :
<form id="Form1" method="post" runat="server" onsubmit="Test();"></form>
hope this helps..
alan
"Michel" wrote: Hi, Thanks for the idea, it was very promissing, and I thought it surely would solve my problem. But:
What I need to do is select entries al the items from a selectbox, which has changed on the clientsite. This entries needs to be submitted together with all the other form information. When I put this script in the onUnload event of the body, it did select the needed data, but it is not added to the form data posted back to the server. (Probably because the data to post is allready gathered, and maybe even sent back, when the onUnload event occures.)
I also tried to put it in the onsubmit event of the form. (alert('test'); but the code generated contained "if (!ValidatorOnSubmit()) return false; alert('test');", and the alert was never executed, although there is no invallid data on the page.
Is their another way to execute a Javascript function before the postback is done?
Thanks in advance,
Michel
"Marina" wrote:
However, this event also happens when the user navigates to a different page, even if it is just by typing in a different we address. It also occurrs when the user closes the browser window. There is no way to tell the difference as to why the event is running.
"Anders Norås [MCAD]" <an**********@objectware.no> wrote in message news:OL****************@TK2MSFTNGP15.phx.gbl... Michel wrote: > Is there some intelligent way to trigger a clientside JavaScript function > before a postback is triggerd by any of the controls on a page? Use the document.onunload event. This event is invoked before the page is posted back.
Anders Norås http://dotnetjunkies.com/weblog/anoras/
have you tried the form's onsubmit event??
"Michel" wrote: Hi, Thanks for the idea, it was very promissing, and I thought it surely would solve my problem. But:
What I need to do is select entries al the items from a selectbox, which has changed on the clientsite. This entries needs to be submitted together with all the other form information. When I put this script in the onUnload event of the body, it did select the needed data, but it is not added to the form data posted back to the server. (Probably because the data to post is allready gathered, and maybe even sent back, when the onUnload event occures.)
I also tried to put it in the onsubmit event of the form. (alert('test'); but the code generated contained "if (!ValidatorOnSubmit()) return false; alert('test');", and the alert was never executed, although there is no invallid data on the page.
Is their another way to execute a Javascript function before the postback is done?
Thanks in advance,
Michel
"Marina" wrote:
However, this event also happens when the user navigates to a different page, even if it is just by typing in a different we address. It also occurrs when the user closes the browser window. There is no way to tell the difference as to why the event is running.
"Anders Norås [MCAD]" <an**********@objectware.no> wrote in message news:OL****************@TK2MSFTNGP15.phx.gbl... Michel wrote: > Is there some intelligent way to trigger a clientside JavaScript function > before a postback is triggerd by any of the controls on a page? Use the document.onunload event. This event is invoked before the page is posted back.
Anders Norås http://dotnetjunkies.com/weblog/anoras/
Yes I have. But it does not work either. The script is executed, but the form
data submitted does not contains my data.
My script selects all the listoptions in a selectbox. (This listbox was
altered at clientside, and I need to retrieve a list of all the options in
this selectbox. To do that, my script have to select all the options, before
the form data is submitted)
Is it possible that the data is allready gathered before ValidatorOnSubmit
function is executed? (My own function is executed after the
ValidatorOnSubmit function)
Michel
"[Alan Flores]" wrote: have you tried the form's onsubmit event??
"Michel" wrote:
Hi, Thanks for the idea, it was very promissing, and I thought it surely would solve my problem. But:
What I need to do is select entries al the items from a selectbox, which has changed on the clientsite. This entries needs to be submitted together with all the other form information. When I put this script in the onUnload event of the body, it did select the needed data, but it is not added to the form data posted back to the server. (Probably because the data to post is allready gathered, and maybe even sent back, when the onUnload event occures.)
I also tried to put it in the onsubmit event of the form. (alert('test'); but the code generated contained "if (!ValidatorOnSubmit()) return false; alert('test');", and the alert was never executed, although there is no invallid data on the page.
Is their another way to execute a Javascript function before the postback is done?
Thanks in advance,
Michel
"Marina" wrote:
However, this event also happens when the user navigates to a different page, even if it is just by typing in a different we address. It also occurrs when the user closes the browser window. There is no way to tell the difference as to why the event is running.
"Anders Norås [MCAD]" <an**********@objectware.no> wrote in message news:OL****************@TK2MSFTNGP15.phx.gbl... > Michel wrote: > > Is there some intelligent way to trigger a clientside JavaScript function > > before a postback is triggerd by any of the controls on a page? > Use the document.onunload event. This event is invoked before the page > is posted back. > > Anders Norås > http://dotnetjunkies.com/weblog/anoras/
It seems that an form.submit() does not trigger the onSubmit function,
therefore the adding the script to the onsubmit will cause the function not
to be executed when a postback is called.
Does anyone have another idea how to call my Javascript function when a
postback is done?
"[Alan Flores]" wrote: have you tried the form's onsubmit event??
"Michel" wrote:
Hi, Thanks for the idea, it was very promissing, and I thought it surely would solve my problem. But:
What I need to do is select entries al the items from a selectbox, which has changed on the clientsite. This entries needs to be submitted together with all the other form information. When I put this script in the onUnload event of the body, it did select the needed data, but it is not added to the form data posted back to the server. (Probably because the data to post is allready gathered, and maybe even sent back, when the onUnload event occures.)
I also tried to put it in the onsubmit event of the form. (alert('test'); but the code generated contained "if (!ValidatorOnSubmit()) return false; alert('test');", and the alert was never executed, although there is no invallid data on the page.
Is their another way to execute a Javascript function before the postback is done?
Thanks in advance,
Michel
"Marina" wrote:
However, this event also happens when the user navigates to a different page, even if it is just by typing in a different we address. It also occurrs when the user closes the browser window. There is no way to tell the difference as to why the event is running.
"Anders Norås [MCAD]" <an**********@objectware.no> wrote in message news:OL****************@TK2MSFTNGP15.phx.gbl... > Michel wrote: > > Is there some intelligent way to trigger a clientside JavaScript function > > before a postback is triggerd by any of the controls on a page? > Use the document.onunload event. This event is invoked before the page > is posted back. > > Anders Norås > http://dotnetjunkies.com/weblog/anoras/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: tshad |
last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an
asp.net problem or a javascript problem.
I have a page that was originally created from a program I found on the net...
|
by: Mark Fox |
last post by:
Hello,
I am attempting to do something very simple. I have
a page MainPage.aspx and a popup window Popup.aspx. When
users click on the linkbutton in the popup window I am
looking to do some...
|
by: Bruce W.1 |
last post by:
There's something I can't figure out. I added some javascript
behavior to my datagrid, just like in this article, except in
C# instead of VB:
...
|
by: Martin Eyles |
last post by:
I am trying to get javascript to cause a page to post back. I have tried
calling _doPostBack from my script, but generates an error "object
expected". I think this is because the page's script...
|
by: Alan Silver |
last post by:
Hello,
I have just discovered that if you turn off Javascript, then cross-page
posting does not work. The postback goes to the originating page, which
basically means that nothing happens.
I...
|
by: vinay |
last post by:
Hi All
I have a page in which i using user control .on user control i using
javascript to pop up a message .when i choose wrong date in user
control & submits the page it alerts the message of...
|
by: =?Utf-8?B?T3Bh?= |
last post by:
Hi,
I'm not sure if the title is correct. Here's what I am having trouble with:
I have a server side button control where I am calling a javascript function
via the OnClientClick property. I...
|
by: Deft.Jab |
last post by:
This problem only exists in IE, due to UI restrictions I'm using a
href in an error label to bring up a modal popup. I'm using a callback
to filter a grid on the popup.
The problem:
The href...
|
by: Peter |
last post by:
ASP.NET
I have an application which use ASP.NET Autocomplete extender which works
great. But I have a question how to update all the fields on the screen
using Ajax.
Users starts typing in a...
|
by: Frinavale |
last post by:
JavaScript in ASP.NET
Using JavaScript in ASP.NET pages can make your application seem to work faster and prevent unnecessary calls to the server. JavaScript can be used to perform client-side...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
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,...
| |