Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. prompt message box on web page using C#

prompt message box on web page using C#

Scheduled Pinned Locked Moved C#
csharp
35 Posts 7 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J jdkulkarni

    Exactly right. You can not pop up MessageBox.Show("") in ASP.NET. You will get this error. "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.". You should only use Alert or Confirm. Especially in your case Confirm should work fine.

    Jayant D. Kulkarni Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET


    Q Offline
    Q Offline
    quiteSmart
    wrote on last edited by
    #7

    u are wrong you can use the messagebox.show follow what i wrote in the previous post(reply) and u will see how. :)

    J B T 3 Replies Last reply
    0
    • M mohd imran abdul aziz

      Dear All, I am making web based Application.There i am making one master page where i am saving, delete data. I need to know how i can prompt message before saving or deleting data(Asking whether user want to save data or not). how i can do it in C#. thanks

      regards imran khan

      A Offline
      A Offline
      albCode
      wrote on last edited by
      #8

      Here is one good example[^]


      "My advice to you is to get married. If you find a good wife, you will be happy; if not, you will become a philosopher." Socrates

      1 Reply Last reply
      0
      • Q quiteSmart

        u are wrong you can use the messagebox.show follow what i wrote in the previous post(reply) and u will see how. :)

        J Offline
        J Offline
        jdkulkarni
        wrote on last edited by
        #9

        Try using this.

        using System;
        using System.Data;
        using System.Configuration;
        using System.Collections;
        using System.Web;
        using System.Web.Security;
        using System.Web.UI;
        using System.Web.UI.WebControls;
        using System.Web.UI.WebControls.WebParts;
        using System.Web.UI.HtmlControls;
        using System.Data;
        using System.Data.Sql;
        using System.Data.SqlClient;
        using System.Windows.Forms;

        public partial class _Default : System.Web.UI.Page
        {
        protected void Page_Load(object sender, EventArgs e)
        {
        MessageBox.Show("Hi");
        }
        }

        Main thing is how MesageBox.Show("") will generate a dialog box at client side? MessageBox object is very specific to desktop. If you have tried the same I'll like to see that code.

        Jayant D. Kulkarni Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET

        1 Reply Last reply
        0
        • Q quiteSmart

          u are wrong you can use the messagebox.show follow what i wrote in the previous post(reply) and u will see how. :)

          B Offline
          B Offline
          Bhupi Bhai
          wrote on last edited by
          #10

          Wow, is it ?? I too would like to c the code. Regards, Bhupi Bhai.

          1 Reply Last reply
          0
          • Q quiteSmart

            u are wrong you can use the messagebox.show follow what i wrote in the previous post(reply) and u will see how. :)

            T Offline
            T Offline
            Tamimi Code
            wrote on last edited by
            #11

            you are idiot ;)

            When you get mad...THINK twice that the only advice Tamimi - Code

            Q 1 Reply Last reply
            0
            • T Tamimi Code

              you are idiot ;)

              When you get mad...THINK twice that the only advice Tamimi - Code

              Q Offline
              Q Offline
              quiteSmart
              wrote on last edited by
              #12

              What?????? Are you talk to me ?

              T 1 Reply Last reply
              0
              • Q quiteSmart

                use the add reference and add it u can use the add reference following these steps: click on the Project in the main menu, --> go down to the add reference --> stay in the .Net tab and scroll down till you find the System.Windows.Forms --> select it and then click add now u should be able to use the message box by just writting MessageBox.show(.......) good luck

                M Offline
                M Offline
                mohd imran abdul aziz
                wrote on last edited by
                #13

                Thanks Very much, It worked fantastic!.Thanks once againe I have one more question. Now i am preparing verious master. some of then are very similar. Like branch master(which has branch name and branch description), Unit master(which has unit code and unit description). So i wanted to make one form and based on menu item selection(Bcoz i used asp:menu).so by using navigationurl. i redirect it to corresponding web Page. Is My idea is correct. Or i have to do it other way. Please help. Anyway thanks you once againe

                regards imran khan

                Q 1 Reply Last reply
                0
                • Q quiteSmart

                  What?????? Are you talk to me ?

                  T Offline
                  T Offline
                  Tamimi Code
                  wrote on last edited by
                  #14

                  you are so funny :laugh::laugh: if you are unable to answer the question, then don't post just you you want to post something.

                  quiteSmart wrote:

                  Are you talk to me ?

                  the next time put some bold text to make me Afraid :zzz::zzz:

                  When you get mad...THINK twice that the only advice Tamimi - Code

                  M 1 Reply Last reply
                  0
                  • T Tamimi Code

                    you are so funny :laugh::laugh: if you are unable to answer the question, then don't post just you you want to post something.

                    quiteSmart wrote:

                    Are you talk to me ?

                    the next time put some bold text to make me Afraid :zzz::zzz:

                    When you get mad...THINK twice that the only advice Tamimi - Code

                    M Offline
                    M Offline
                    mohd imran abdul aziz
                    wrote on last edited by
                    #15

                    what u are writing. quickSmart code is absolutly write and It worked. thacks quickSmart.

                    regards imran khan

                    B T Q 3 Replies Last reply
                    0
                    • M mohd imran abdul aziz

                      what u are writing. quickSmart code is absolutly write and It worked. thacks quickSmart.

                      regards imran khan

                      B Offline
                      B Offline
                      Bhupi Bhai
                      wrote on last edited by
                      #16

                      Good !! So ur happy, now let's close this topic. Thanks :) Regards, Bhupi Bhai.

                      1 Reply Last reply
                      0
                      • M mohd imran abdul aziz

                        what u are writing. quickSmart code is absolutly write and It worked. thacks quickSmart.

                        regards imran khan

                        T Offline
                        T Offline
                        Tamimi Code
                        wrote on last edited by
                        #17

                        are you nuts ? how its working

                        When you get mad...THINK twice that the only advice Tamimi - Code

                        Q 1 Reply Last reply
                        0
                        • T Tamimi Code

                          are you nuts ? how its working

                          When you get mad...THINK twice that the only advice Tamimi - Code

                          Q Offline
                          Q Offline
                          quiteSmart
                          wrote on last edited by
                          #18

                          just do as i wrote and u will see that it worked now all know who is the idiot here. asshole

                          1 Reply Last reply
                          0
                          • M mohd imran abdul aziz

                            what u are writing. quickSmart code is absolutly write and It worked. thacks quickSmart.

                            regards imran khan

                            Q Offline
                            Q Offline
                            quiteSmart
                            wrote on last edited by
                            #19

                            your welcome let us skip what idiots like Tamimi - Code write in this blog. Some people think that they know everything but actually they know nothing cause they don't accept a new thing to learn. take care, happy to help at any time

                            T 1 Reply Last reply
                            0
                            • Q quiteSmart

                              your welcome let us skip what idiots like Tamimi - Code write in this blog. Some people think that they know everything but actually they know nothing cause they don't accept a new thing to learn. take care, happy to help at any time

                              T Offline
                              T Offline
                              Tamimi Code
                              wrote on last edited by
                              #20

                              man maybe iam idiot. but did exactly what you wrote, and this what i got. ------------- Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification ------------- so what si this !!!!

                              When you get mad...THINK twice that the only advice Tamimi - Code

                              Q 1 Reply Last reply
                              0
                              • T Tamimi Code

                                man maybe iam idiot. but did exactly what you wrote, and this what i got. ------------- Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification ------------- so what si this !!!!

                                When you get mad...THINK twice that the only advice Tamimi - Code

                                Q Offline
                                Q Offline
                                quiteSmart
                                wrote on last edited by
                                #21

                                hi, i haven't seen that error before, but i don't write things just to add a post to my score. I write things when i am sure that it will work. And a proof for that is what the real poster wrote that it worked with him as it worked with me several times before. see what is really giving that error. debug it and see at what line it is going

                                T 1 Reply Last reply
                                0
                                • Q quiteSmart

                                  hi, i haven't seen that error before, but i don't write things just to add a post to my score. I write things when i am sure that it will work. And a proof for that is what the real poster wrote that it worked with him as it worked with me several times before. see what is really giving that error. debug it and see at what line it is going

                                  T Offline
                                  T Offline
                                  Tamimi Code
                                  wrote on last edited by
                                  #22

                                  man jdkulkarni also metion my error !! realy i don't think so.....................

                                  When you get mad...THINK twice that the only advice Tamimi - Code

                                  Q 1 Reply Last reply
                                  0
                                  • T Tamimi Code

                                    man jdkulkarni also metion my error !! realy i don't think so.....................

                                    When you get mad...THINK twice that the only advice Tamimi - Code

                                    Q Offline
                                    Q Offline
                                    quiteSmart
                                    wrote on last edited by
                                    #23

                                    i checked that again now and it worked fine i don't know what is wrong with your code. What version of VS are you using mine is VS 2005 Look, just follow these steps: 1) create a new web application 2) go to the designer 3) add a button 4) double click the button 5) click on the project in the main menu. 6) add reference 7) in the .NET tab go to the System.Windows.Forms and click add 8) go to the source code of ur project. 9) add this name space using System.Windows.Forms 10) in the onClick event of the button write: MessageBox.Show("quiteSmart is very smart "); :) and it will work

                                    T B 2 Replies Last reply
                                    0
                                    • M mohd imran abdul aziz

                                      Thanks Very much, It worked fantastic!.Thanks once againe I have one more question. Now i am preparing verious master. some of then are very similar. Like branch master(which has branch name and branch description), Unit master(which has unit code and unit description). So i wanted to make one form and based on menu item selection(Bcoz i used asp:menu).so by using navigationurl. i redirect it to corresponding web Page. Is My idea is correct. Or i have to do it other way. Please help. Anyway thanks you once againe

                                      regards imran khan

                                      Q Offline
                                      Q Offline
                                      quiteSmart
                                      wrote on last edited by
                                      #24

                                      sorry man, i don't work much on ASP, my basic work is C# but i have passed through ASP for my own knowledge only. I am not sure about the answer i will give you but i think that what u said is logic and will work. Hope u get the best out of it. Note: for next time please post the ASP questions in the ASP MessageBoard Good Luck

                                      M 1 Reply Last reply
                                      0
                                      • Q quiteSmart

                                        i checked that again now and it worked fine i don't know what is wrong with your code. What version of VS are you using mine is VS 2005 Look, just follow these steps: 1) create a new web application 2) go to the designer 3) add a button 4) double click the button 5) click on the project in the main menu. 6) add reference 7) in the .NET tab go to the System.Windows.Forms and click add 8) go to the source code of ur project. 9) add this name space using System.Windows.Forms 10) in the onClick event of the button write: MessageBox.Show("quiteSmart is very smart "); :) and it will work

                                        T Offline
                                        T Offline
                                        Tamimi Code
                                        wrote on last edited by
                                        #25

                                        man please stop kidding with me, that what i did exactly. i tried it on VS2005 and VS2003 and its working and it gives the same error. are you running under windows ??

                                        When you get mad...THINK twice that the only advice Tamimi - Code

                                        Q 1 Reply Last reply
                                        0
                                        • Q quiteSmart

                                          i checked that again now and it worked fine i don't know what is wrong with your code. What version of VS are you using mine is VS 2005 Look, just follow these steps: 1) create a new web application 2) go to the designer 3) add a button 4) double click the button 5) click on the project in the main menu. 6) add reference 7) in the .NET tab go to the System.Windows.Forms and click add 8) go to the source code of ur project. 9) add this name space using System.Windows.Forms 10) in the onClick event of the button write: MessageBox.Show("quiteSmart is very smart "); :) and it will work

                                          B Offline
                                          B Offline
                                          Bhupi Bhai
                                          wrote on last edited by
                                          #26

                                          VS2003 does not support this and I am sure VS2005 will also not !! Regards, Bhupi Bhai.

                                          Q 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups