How to have a error create a pop-up?

Discussion in 'ASP .Net' started by REB, Feb 5, 2004.

  1. REB

    REB Guest

    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?
    }
     
    REB, Feb 5, 2004
    #1
    1. Advertising

  2. REB

    Curt_C [MVP] Guest

    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" <> wrote in message
    news:uR$...
    > 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?
    > }
    >
    >
     
    Curt_C [MVP], Feb 5, 2004
    #2
    1. Advertising

  3. REB

    Earl Teigrob Guest

    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","<SCRIPT
    LANGUAGE=\"JavaScript\">alert('"+ Message +"');</Script>");

    }

    }





    "REB" <> wrote in message
    news:uR$...
    > 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?
    > }
    >
    >
     
    Earl Teigrob, Feb 5, 2004
    #3
  4. REB

    REB Guest

    Can a response.write be used to cause a pop-up?


    "REB" <> wrote in message
    news:uR$...
    > 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?
    > }
    >
    >
     
    REB, Feb 5, 2004
    #4
  5. REB

    Curt_C [MVP] Guest

    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" <> wrote in message
    news:...
    > Can a response.write be used to cause a pop-up?
    >
    >
    > "REB" <> wrote in message
    > news:uR$...
    > > 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?
    > > }
    > >
    > >

    >
    >
     
    Curt_C [MVP], Feb 5, 2004
    #5
  6. REB

    REB Guest

    Does something like this work?

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

    Are there any drawbacks to using it this way?

    "REB" <> wrote in message
    news:uR$...
    > 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?
    > }
    >
    >
     
    REB, Feb 5, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    8,560
    Randy Webb
    Feb 4, 2006
  2. Bone Ur
    Replies:
    4
    Views:
    408
    Bone Ur
    Dec 19, 2007
  3. Chris Davoli

    Tool Tip pop up - pop up time is too short

    Chris Davoli, Feb 24, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    491
    Lee Atkinson
    Feb 24, 2009
  4. samppi
    Replies:
    27
    Views:
    514
    David A. Black
    Dec 5, 2007
  5. Madame Blablavatsky
    Replies:
    8
    Views:
    180
    Dr John Stockton
    Sep 16, 2005
Loading...

Share This Page