472,954 Members | 1,937 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,954 software developers and data experts.

Page disappears when alert shows?

When I click a Button server control I want two things to happen.

The server returns a string array of error messages.
A Javascript alert appears showing the errors.

I can do this using the following method

public void ShowErrorWindow(string[] errors)
{
string alertString = null;
foreach(string str in errors)
alertString += str + "\\n";
string jscript = "<script language='JavaScript'>alert('" +
alertString + "');</script>";
RegisterClientScriptBlock("key", jscript);
}

The problem is that the page behind the alert dialog disappears and the
reappears when the dialog is closed. This is not the case when the alert
is generated client side.

Can anyone help on this.
Thanks
Robert Zurer
Nov 18 '05 #1
4 1782
Replace registerclient... with
Page.Controls.Add(new literalcontrol(
everything after that should stay the same.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Robert Zurer" <ro****@zurer.com> wrote in message
news:MP************************@news.microsoft.com ...
When I click a Button server control I want two things to happen.

The server returns a string array of error messages.
A Javascript alert appears showing the errors.

I can do this using the following method

public void ShowErrorWindow(string[] errors)
{
string alertString = null;
foreach(string str in errors)
alertString += str + "\\n";
string jscript = "<script language='JavaScript'>alert('" +
alertString + "');</script>";
RegisterClientScriptBlock("key", jscript);
}

The problem is that the page behind the alert dialog disappears and the
reappears when the dialog is closed. This is not the case when the alert
is generated client side.

Can anyone help on this.
Thanks
Robert Zurer

Nov 18 '05 #2
The RegisterStartupScript method instead RegisterClientScriptBlock I think
can help you!

Brun

"Robert Zurer" <ro****@zurer.com> wrote in message
news:MP************************@news.microsoft.com ...
When I click a Button server control I want two things to happen.

The server returns a string array of error messages.
A Javascript alert appears showing the errors.

I can do this using the following method

public void ShowErrorWindow(string[] errors)
{
string alertString = null;
foreach(string str in errors)
alertString += str + "\\n";
string jscript = "<script language='JavaScript'>alert('" +
alertString + "');</script>";
RegisterClientScriptBlock("key", jscript);
}

The problem is that the page behind the alert dialog disappears and the
reappears when the dialog is closed. This is not the case when the alert
is generated client side.

Can anyone help on this.
Thanks
Robert Zurer

Nov 18 '05 #3
In article <p_**********************@news3.tin.it>,
br***********@virgilio.it says...
Page.Controls.Add(new literalcontrol(
The RegisterStartupScript method instead RegisterClientScriptBlock I think
can help you!

Thank you both so much. Both work well.

I would appreciate your recommendations for a book which would cover
these kind of issues in depth. I'm not new to programming or C# but, as
you can see, have not done much Web front-end coding.
Robert Zurer

Nov 18 '05 #4
have a look at my website http://tinyurl.com/27cok
i have a book review section. it's difficult to recommend a book because
different books cater to different levels. if you need an all encompassing
book a few levels up from starter, try walthers. If you are at the expert
level and need to know why stuff happens, esposito is where it is.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Robert Zurer" <ro****@zurer.com> wrote in message
news:MP************************@news.microsoft.com ...
In article <p_**********************@news3.tin.it>,
br***********@virgilio.it says...
Page.Controls.Add(new literalcontrol(


The RegisterStartupScript method instead RegisterClientScriptBlock I
think
can help you!

Thank you both so much. Both work well.

I would appreciate your recommendations for a book which would cover
these kind of issues in depth. I'm not new to programming or C# but, as
you can see, have not done much Web front-end coding.
Robert Zurer

Nov 18 '05 #5

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

Similar topics

1
by: ck388 | last post by:
I am trying to open a frameset in a new window......where the frame called "main" shows the file called customerGeneral.aspx. I can't get it to work though...i always get something like...
7
by: Wen | last post by:
Hi everyone, ..After my first lesson, I have to create a asp page with: ..asp tag for time ..client script that runs at the server for date ..client script that runs at client and shows a...
0
by: Justice75 | last post by:
HI All, I am having a problem that is driving me crazy. I have this asp file which queries three table sin the db and writes the records. That part is fine (process). The page is sorted in...
5
by: A.M | last post by:
Hi, My ASP.NET application uses SSL on IIS6. up on visiting some pages, IE 6 shows this security alert: This page contains both secure and non secure items. Do you want to display non-secure...
2
by: Goober | last post by:
I have the following default.aspx page that works properly. However, what I want to do is to link the graphics within it (that are hard coded now in the default web page) to our corporate...
4
by: Magnus Blomberg | last post by:
Hello! I have a problem when using a hidden field to send a value to the server. Below you can see my code in simplyfied versions. What I'm trying to do is: 1. The user browses for a picture...
12
by: joe | last post by:
I have a Javascript page which needs to be dynamically changed depending on user input. The whole page is written on document.write() output. I am still new to Javascript and run into problems...
3
by: John Passaniti | last post by:
Hopefully someone can point out what I'm doing wrong. I find myself having to dynamically create HTML code, and have found that the usual way you see to do this is an unreadable mess, like this:...
5
by: BobRoyAce | last post by:
I have a website for which I am trying to automate interactions with. The first page shows the first page of results of a search, each result having a checkbox next to it. In addition, I have...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.