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

doPostBack

Hi ,

I used your suggested code to replace doPostBack in my application, but it
seems window.onbeforeunload is called before, window.__doPostBack, so it can
not change the condition for showing warning message.
I am using datagrid with links as ButtonColumn but I do not want
onbeforeunload event called when they are clicked.

Any suggestion?

Thanks
Masoud

"bruce barker" <no***********@safeco.com> wrote in message
news:O5****************@TK2MSFTNGP11.phx.gbl...
1) could be any control thats supports validation on the page (must not be
empty)

2)

air code:

RegisterStartupScript("postback",@"
<script>
if (window.__doPostBack) {
window.__oldPostBack = window.__doPostBack;
window.__doPostBack = function(t, a) {
// add custom code here
window.__oldPostBack(t,a);
}
</script>
");

-- bruce (sqlwork.com)
"lilfos" <do**********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
| Thanks Bruce.
|
| A couple of questions:
|
| 1. I would need to set a custom validator's "control to validate"
| property, right? If so, would that be the DataGrid? The links
| themselves are not controls and they are not available at design time.
|
| 2. How would I replace __doPostBack? I saw a reference to this in
| another post and tried things like oldPostBack = __doPostBack;
| __doPostBack = myPostBack, but this seemed to have not effect. I
| figure those were just interpreted as variable names rather than
| function names, so the functions themselves never changed.
| Thanks again.
|


here are two approaches

1) write a custom validator that sets the flag
2) replace __doPostback with your own routine that sets the flag. note:
submit buttons donot call __doPostback, so you must also catch the postback
in the onsubmit handler.

-- bruce (sqlwork.com


Hi there,

I have an asp.net page with essentially a "don't forget to save" pop-up
that is called when the user attempts to navigate away from the page.
The user has the option to cancel and prevent the page from unloading.

Since the form data is posted back to the server and saved during a
normal postback, I don't need to prompt unless the user is actually
going to a different URL or closing the browser. Currently, I get
around this with a hidden field called hidPromptToSave and by checking
that in my function that onbeforeunload calls. I configured each
control that causes a postback to set that value to false, which causes
the function to exit without prompting.

This worked when I could add the onclick attribute to the controls in
the OnInit method in my code behind. Now, however, I have added a
twist. I added paging to a datagrid and each page link causes a
postback (naturally). Unfortunately, the page links are anchor tags
with an href that calls doPostBack. I can't seem to find a way to add
to the href or onclick attributes of these links. I've tried a whole
lot of things both client-side and server-side.

Assuming I won't ever find a way to add attributes to those links, can
anyone suggest a different way to give a user the chance to save before
closing or navigating away, but not doing this on postpack? One
additional restriction is that we don't want to automatically save
without asking and then let them continue.

Thanks!


Nov 19 '05 #1
0 4280

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

Similar topics

0
by: valmir cinquini | last post by:
Hi, I've noticed that a doPostBack call always cause the position of the page goes up to the top of the page, after round trip. I'd like to place the page at original position where it was...
1
by: George | last post by:
I have problems with anything that uses doPostBack. I am running .NET Framework 1.0.3705.288. Any advice would be greatly appreciated.
0
by: Mike | last post by:
Is there a key that can be used to pass to the Page.IsClientScriptBlockRegistered() to check if the dopostback() function has already been registered to the page? If not any ideas on how to check...
0
by: Matt Petteys | last post by:
I'm using 1.1 framework and IE 6.0. A form within a user control generates the following doPostBack method. The control ID of the form is not a valid javascript variable name, ie...
0
by: jm | last post by:
In my form, datagrid, etc., I have it so when the user enters certain criteria and click the button, the appropriate records return. If the user enters no criteria, all the records return (in a...
3
by: Mad Scientist Jr | last post by:
I have some javascript I would like to run after a doPostBack occurs: onchange="javascript:__doPostBack('Text1','');" The doPostBack is being added dynamically by .NET when it renders the...
4
by: Zuel | last post by:
Hi Folks. So I have a small problem. My DoPostBack function is not writen to the HTML page nor are the asp:buttons calling the DoPostBack. My Goal is to create a totaly dynamic web page where...
2
by: DSipp | last post by:
First, I am not a developer. My company works with a partner. This partner has a web app that we interact with. All of my systems can connect and login to this site. When we select an issue link,...
6
by: Mark Olbert | last post by:
The doPostBack javascript functioning is not submitting the page when called by linkbuttons (or an autopostback checkbox, for that matter). I'm aware of a problem with Netscape browsers and the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.