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

Using alert in ASP.NET 2005

19
I am using alert, when user has successfully inserted the values in database.


for ex:

Response.Write("<script>alert("You have successfully inserted values");</script>");

This code successfully runs, but the problem is that when I press the back button in my application from any page , this alert box also appears.
I don't want alert window to appear when clicking on Back button.

Please suggest what should I do.

Thank you.
Dec 17 '07 #1
4 1326
mzmishra
390 Expert 256MB
probably u need to have one variable use it as a flag to determine the success and failure operation and reset that after your alert message.
Also check for the caching in your page for back button problem.
Dec 17 '07 #2
Plater
7,872 Expert 4TB
I would guess that you are doing something in the page_load() function that is either not switched on by the isPostback variable, or should be performed elsewhere.
Dec 17 '07 #3
nateraaaa
663 Expert 512MB
As Plater said you should check your Page_Load method. In addition to that you could create a label and set the Text property = to the javascript alert.

Expand|Select|Wrap|Line Numbers
  1. lblMessage.Text = "<script>alert('Inserted Successfully');</script>";
You can then use the Visible property to hide or display this message at the appropriate time.

So in the Page_Load method set your label's visible property to false. In the button click event (or whatever control inserts records) change the label's visible property to true.

Nathan
Dec 17 '07 #4
Frinavale
9,735 Expert Mod 8TB
It's may not be your server side Page_Load that's being called.
It's the fact that your script runs when your html page is loaded.

You should use a hidden field that is set to "true" when the user clicks "ok" in your alert box. This hidden value can be used by your JavaScript (to prevent it from running during your window.onload event) and can also be used by your Server Side code (to prevent the JavaScript for the alert from being sent to the browser at all).

-Frinny
Dec 17 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: designsimply | last post by:
I am trying to http post some xml to to a remote server using php. When I try to submit xml using PEAR's HTTP_Client::post() to the remote server, I get back the following "Invalid Document Format"...
4
by: hugo2 | last post by:
Most of these characters are not on the standard keyboard. Here's a successful contrivance, with comments & cautions, a little page that works in IE6. <HTML><HEAD><SCRIPT TYPE="text/javascript">...
2
by: Kenneth | last post by:
I am tryint to view a xml document in Internet Exploer as a ActiveX object using Javascript but it does not work. I only see the button but nothing happens when i click it. I am trying to view...
6
by: bonehead | last post by:
Greetings, I'm working on an e-mail form (btw many thanks to Philip Ronan for the very cool email address format tester function, best I've seen so far). I've been trying, with limited...
0
by: nycjay | last post by:
i am trying to use the db2 health monitor alert to run a script. i set up the health monitor to run a script when the tablespace utailization is too high. in the end, the script should send a...
3
by: Kuldeep | last post by:
Framework: Visual Studio 2005 Technology: ASP.NET 2.0 Language: C#.NET 2.0 Hi All, I have an event procedure as shown below. protected void lnkBtSendEmail_Click(object sender, EventArgs e)
0
by: Patrick | last post by:
Hi, I have trouble getting the alerts to work on SQL 2005. Below I define a custom message and a custom alert. When I raise the error though the alert never fires. Any ideas why that would...
7
by: Neil Jones | last post by:
Hello, We have a large database of our customers. Some of the important customers records are flagged and can be accessed only by applications designed for upper management. The management...
13
by: ramprakashjava | last post by:
hi, i hav "java.lang.NullPointerException" error while Deleting table records using checkbox in jsp here i enclosed files help quickly plzzz.. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.