467,915 Members | 1,101 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

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
  • viewed: 1616
Share:
4 Replies
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Justice75 | last post: by
2 posts views Thread by Goober | last post: by
4 posts views Thread by Magnus Blomberg | last post: by
12 posts views Thread by joe | last post: by
3 posts views Thread by John Passaniti | last post: by
5 posts views Thread by BobRoyAce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.