473,402 Members | 2,061 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,402 software developers and data experts.

How to have a error create a pop-up?

REB
What is the code in C# to have a pop-up when a function throws an error?

catch(Exception ex)
{
Show pop up with text from ex in it?
}
Nov 18 '05 #1
5 1353
you'll have to pass it to a clientside call.
javascript:alert('yourError');
perhaps, or a window.open() or a window.showModalDialog()

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"REB" <ru**@bjorgaard.com> wrote in message
news:uR**************@TK2MSFTNGP09.phx.gbl...
What is the code in C# to have a pop-up when a function throws an error?

catch(Exception ex)
{
Show pop up with text from ex in it?
}

Nov 18 '05 #2
I often use the Page.RegisterStartupScript in an event handler to write a
javascript alert that can be based on a condition allows the entire page
loads before the alert pops up...very handy for me...

(note, this method also makes the message tablerow visible and writes to a
literal control in that row)
private void UserMessage(string Message, bool Popup)

{
StatusMessage.Text=Message;

ShowMessage.Visible=true;

if (Popup)

{

Page.RegisterStartupScript("StatusMessage","<SCRIP T
LANGUAGE=\"JavaScript\">alert('"+ Message +"');</Script>");

}

}

"REB" <ru**@bjorgaard.com> wrote in message
news:uR**************@TK2MSFTNGP09.phx.gbl...
What is the code in C# to have a pop-up when a function throws an error?

catch(Exception ex)
{
Show pop up with text from ex in it?
}

Nov 18 '05 #3
REB
Can a response.write be used to cause a pop-up?
"REB" <ru**@bjorgaard.com> wrote in message
news:uR**************@TK2MSFTNGP09.phx.gbl...
What is the code in C# to have a pop-up when a function throws an error?

catch(Exception ex)
{
Show pop up with text from ex in it?
}

Nov 18 '05 #4
no... not unless you Response.Write() some clientside script.
There is not "open a new window" option in the Response.Write, sorry.

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"REB" <ru**@bjorgaard.com> wrote in message
news:ud**************@TK2MSFTNGP11.phx.gbl...
Can a response.write be used to cause a pop-up?
"REB" <ru**@bjorgaard.com> wrote in message
news:uR**************@TK2MSFTNGP09.phx.gbl...
What is the code in C# to have a pop-up when a function throws an error?

catch(Exception ex)
{
Show pop up with text from ex in it?
}


Nov 18 '05 #5
REB
Does something like this work?

Response.Write("<SCRIPT LANGUAGE='JavaScript1.2'> alert('Error!')
</Script>");

Are there any drawbacks to using it this way?

"REB" <ru**@bjorgaard.com> wrote in message
news:uR**************@TK2MSFTNGP09.phx.gbl...
What is the code in C# to have a pop-up when a function throws an error?

catch(Exception ex)
{
Show pop up with text from ex in it?
}

Nov 18 '05 #6

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

Similar topics

6
by: Baloff | last post by:
Hello I wrote a code which is suppose to read a file which contains lines of double and prints it out. thanks for helping double.txt*************************************** 1.01 2.0301
9
by: M.N.A.Smadi | last post by:
HI; I am having the following error. I am using someone else's code and all they are doing is pass an argv to a function then def execute_action(manager, argv): method_name =...
5
by: damian birchler | last post by:
What's wrong about this: 22: static void (*)(void) instruction_table = { jnz, halt, mv, add, mul, mv_reg, add_reg,
2
by: tllee | last post by:
I wrote a simple stack program using class template on VC++ 2003 but am unable to resolve the following link errors: LINK : error LNK2020: unresolved token (0A000046) Stack.__dtor LINK : error...
4
by: zlj0000 | last post by:
//迷宫问题 #include<stdio.h> #include<malloc.h> #define sqstack S #define STACK_INIT_SIZE 100 #define STACKINCREMENT 10 struct zuobiao{ int i;
1
by: steele20 | last post by:
hello I am getting this strange error Linking... Cpp2.obj : error LNK2001: unresolved external symbol "public: bool __thiscall Stack::push(char const &)" (?push@Stack@@QAE_NABD@Z) Debug/Cpp2.exe...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, Does vb2005 have a built-in UnDo feature / object for applications so that I can undo actions like other windows apps? Or do I have to write my own UnDo routine? If vb2005 does have a...
3
by: shrew83 | last post by:
Hi, could anyone please tell me what is the problem with the following code : const int MAX = 100; class Stack{ protected: int stk; int top; ...
5
by: =?Utf-8?B?a2F0?= | last post by:
Account: 'pop.griffincreek.net (3)', Server: 'pop.griffincreek.net', Protocol: POP3, Server Response: '-ERR Invalid command.', Port: 110, Secure(SSL): No, Server Error: 0x800CCC90, Error Number:...
2
by: Jolie Chen | last post by:
I am learning template programming now, and I wrote the following code #include <iostream> #include "Queue.h" using namespace std; template <typename Tclass QueueItem { public: QueueItem(T...
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: 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
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.