0

Hello,
I have an ASP web application and in the C# code behind I want to present the user with a simple yes/no dialog box that gives them the opportunity to save a file that their input has created.
I've used a simple implementation of ClientScript.RegisterStartupScript elsewhere in the code to display simple messages, but I'm having trouble getting a yes/no type dialog to appear. I'm using this code:

      try
      {
        ClientScript.RegisterStartupScript(this.GetType(), "Msg", "<script type=\"text/javascript\"  language=\"javascript\">function showMsg(){return confirm(\"Do you want to save the WH XML file created?\");}</script>", true);
      }

But the dialog never appears. Can someone suggest where my mistake is?

3
Contributors
3
Replies
6
Views
5 Years
Discussion Span
Last Post by swathi@123
0

Try this

 try
 {
    ClientScript.RegisterStartupScript(this.GetType(), 
        "Msg", 
        "return confirm('Do you want to save the WH XML file created?');",
        true);
}
0

Still no dialog box appears. The code is traversed, but nothing happens...
Thanks

0

ClientScript.RegisterStartupScript(GetType(), "messagebox", "<script language='javascript' type='text/javascript'>confirm('Do you want to save the WH XML file created?');</script>");

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.