By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,204 Members | 1,171 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,204 IT Pros & Developers. It's quick & easy.

Page disappears when alert shows?

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.