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

javascript alert() after postback c#

PH
Does anyone know how to have the pop-up javascript alert,

Response.Write("<script language=javascript>alert('HEY!');</script>);

, pop-up after the page has been posted back? I am pressing a button,
validating data and then wanting to simply pop-up an alert if say the
login is empty. When I click the button though the page is blank but
the pop-up is there.
Jul 21 '05 #1
6 9164
Hi PH

The Page provides a method, RegisterStartupScript to do this. For example:

Dim startupScript As String
startupScript = "<script
language=""javascript"">alert('Hello!');</script>"

If IsPostBack Then
RegisterStartupScript("startup", startupScript)
End If

HTH

James.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"PH" <p_*******@yahoo.com> wrote in message
news:c5**************************@posting.google.c om...
Does anyone know how to have the pop-up javascript alert,

Response.Write("<script language=javascript>alert('HEY!');</script>);

, pop-up after the page has been posted back? I am pressing a button,
validating data and then wanting to simply pop-up an alert if say the
login is empty. When I click the button though the page is blank but
the pop-up is there.

Jul 21 '05 #2
Hi PH

The Page provides a method, RegisterStartupScript to do this. For example:

Dim startupScript As String
startupScript = "<script
language=""javascript"">alert('Hello!');</script>"

If IsPostBack Then
RegisterStartupScript("startup", startupScript)
End If

HTH

James.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"PH" <p_*******@yahoo.com> wrote in message
news:c5**************************@posting.google.c om...
Does anyone know how to have the pop-up javascript alert,

Response.Write("<script language=javascript>alert('HEY!');</script>);

, pop-up after the page has been posted back? I am pressing a button,
validating data and then wanting to simply pop-up an alert if say the
login is empty. When I click the button though the page is blank but
the pop-up is there.

Jul 21 '05 #3
Hi, I just want to know that have you got an answer for this. Please
let me know. Thanks.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Jul 21 '05 #4
Yes - but it would help if I know what the question was?

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"rajandsa" <ra******@hotmail-dot-com.no-spam.invalid> wrote in message
news:41********@Usenet.com...
Hi, I just want to know that have you got an answer for this. Please
let me know. Thanks.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Jul 21 '05 #5
> Hi, I just want to know that have you got an answer for this. Please
let me know. Thanks.


Yes.

What's the question? :)

-Per
Jul 21 '05 #6
Using RegisterStartupScript I registered script on page which has
alert on it when the validation fails on the page. After validation
passes I am redirecting to another page. After that when I click a
back button on the browser, that validation pop up message box
appears on the page. How can I prevent this? I know why it is
happening bacause, the page is not completly submitted due to
redirecting page. Please let me know if you can help. Thanks.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Jul 21 '05 #7

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

Similar topics

2
by: Cathy | last post by:
Has anyone ever made a webform button run an onClick event that is a Javascript in the HTML code and then after running the script make it go into the code-behind? An HTML button will run the...
7
by: Michel | last post by:
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
14
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...
4
by: PH | last post by:
Does anyone know how to have the pop-up javascript alert, Response.Write("<script language=javascript>alert('HEY!');</script>); , pop-up after the page has been posted back? I am pressing a...
2
by: duncan | last post by:
why does this work :- <HEAD> ...... <SCRIPT LANGUAGE="javascript"> function test() { alert("test 1") } </SCRIPT>
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
12
by: Joe | last post by:
Hello All: I'm sure that one of you can quickly spot the error in my script. I am using a small javascript function to retrieve the text of a hyperlink in a datagrid column. Here is my...
3
by: Darrel | last post by:
I have a page that lists a bunch of items. You can check each item and hit ADD to add these items to a record in the DB. This page has a dropDownList. When you select an item from the list, I...
7
by: Assimalyst | last post by:
Hi, I want to create a popup to notify a user that the server side process has completed successfully. I intended to use a javascript alert to do this, although ideally the icon should be...
20
by: Peter | last post by:
I need a popup alert after a post back. 1) user clicks on the submit button 2) Server side code runs and if the result is false I want to display a java script alert("It did not work") How to...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.