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

ASP.NET message box

Hi all,
I have a web form with an error message box that pops up when there is a SQL
error on the back end, after the web form is submitted. Now, the problem is
that the error message pops up before the UI is re-rendered to the page,
causing the page to be blank (white background) with the error message box
being the only thing the user sees.

I know this is happening because when the form is posted back, it needs to
reload. So my question is, is it possible to show the error message after
the GUI (form's controls) is shown. It should behave exactly like a
ValidationSummary message box (although validation is performed before the
postback), with a postback.

The code used to generate an error message box is below:
ClientScript.RegisterClientScriptBlock(Me.Page.Get Type(), "ErrorMessage",
"<script language='javascript'alert('Error:" & ErrorMessageStr &
"');</script>")

Any suggestions welcome?

Thanks
Goran
Nov 5 '07 #1
4 2119
"Goran Djuranovic" <go**************@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
ClientScript.RegisterClientScriptBlock(Me.Page.Get Type(), "ErrorMessage",
"<script language='javascript'alert('Error:" & ErrorMessageStr &
"');</script>")
ClientScript.RegisterStartupScript(GetType(), "ErrorMessage",
"alert('Error:" & ErrorMessageStr & "');", True)

Using the boolean overload makes ASP.NET insert the <scripttags
automatically, so you avoid using deprecated syntax like
"language='javascript'"...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 5 '07 #2
Mark,
OK, this automatically generates the script tags, but doesn't seem to help
the main problem. Any other suggestions?

Thanks
Goran

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OE****************@TK2MSFTNGP02.phx.gbl...
"Goran Djuranovic" <go**************@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>ClientScript.RegisterClientScriptBlock(Me.Page.Ge tType(), "ErrorMessage",
"<script language='javascript'alert('Error:" & ErrorMessageStr &
"');</script>")

ClientScript.RegisterStartupScript(GetType(), "ErrorMessage",
"alert('Error:" & ErrorMessageStr & "');", True)

Using the boolean overload makes ASP.NET insert the <scripttags
automatically, so you avoid using deprecated syntax like
"language='javascript'"...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 5 '07 #3
"Goran Djuranovic" <go**************@newsgroups.nospamwrote in message
news:u9****************@TK2MSFTNGP02.phx.gbl...
OK, this automatically generates the script tags, but doesn't seem to help
the main problem. Any other suggestions?
Apologies - I didn't read your post closely enough...

This should solve your problem:
http://www.velocityreviews.com/forum...age-loads.html
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 5 '07 #4
Mark,
Exactly what I needed.

Thanks a bunch.
Goran

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl...
"Goran Djuranovic" <go**************@newsgroups.nospamwrote in message
news:u9****************@TK2MSFTNGP02.phx.gbl...
>OK, this automatically generates the script tags, but doesn't seem to
help the main problem. Any other suggestions?

Apologies - I didn't read your post closely enough...

This should solve your problem:
http://www.velocityreviews.com/forum...age-loads.html
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 5 '07 #5

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

Similar topics

3
by: Hugh Welford | last post by:
Hi Using WIN XP and FP2000 Using CDO.message to out put a message from my site, I get the following error message 8004020f from using the code:- strsql = "SELECT * FROM details WHERE patid...
8
by: Brian Keating EI9FXB | last post by:
Would I be correct in saying that the only way to get a user message into a Windows form would be to use P/Invoke with Message? Of is there some part of the .NET API that I am totally un aware...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
2
by: Microsoft News | last post by:
What I have is a message box that pops up. It is another browser window. The code is a general function that you pass message, title and a key to. The box works great except, that if you are on a...
0
by: ronscottlangham | last post by:
I am working on a custom WCF EndpoingBehavior that will modify the messages coming in and out of my Service. I am having an error related to the modification of the message in the...
2
by: =?Utf-8?B?QWRl?= | last post by:
HI All, I am encountering the following error when I try to send an email through a SMTP server. I believe the problem lies with the authentication part when the network crednetials are used,...
3
by: Steven Allport | last post by:
I am working on processing eml email message using the email module (python 2.5), on files exported from an Outlook PST file, to extract the composite parts of the email. In most instances this...
0
by: Philluminati | last post by:
I have a Perl SOAP Server which returns this SOAP Message when invoked: <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http:// www.w3.org/2001/XMLSchema-instance"...
2
by: bernd | last post by:
Hi netties, posted this in a different group already, which seems to be inappropriate. I create a message queue with msgget(), sent a 5-byte message to it with msgsnd() and try to receive the...
2
by: forums_mp | last post by:
Facing a design problem here and I'm not sure how to solve this. The system consists of bi-directional communication between a subject communicating with two (at least for now ) listeners. ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.