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. Web Development
  3. ASP.NET
  4. alert problem

alert problem

Scheduled Pinned Locked Moved ASP.NET
javascripthelptutorialquestion
12 Posts 5 Posters 0 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.
  • K Kissy16

    Here i am using the following javascript for alert a msgwindow.problem is, it is opening new page and giving the message,How to alert the same in the same page??It is happening on a button click event. ---> if txt1.text="" then Response.Write(" alert(' Enter username,it shd not be null '); ") end if

    kissy

    R Offline
    R Offline
    RaviJJain
    wrote on last edited by
    #2

    try this one response.write(" ....):) </x-turndown>

    K 1 Reply Last reply
    0
    • R RaviJJain

      try this one response.write(" ....):) </x-turndown>

      K Offline
      K Offline
      Kissy16
      wrote on last edited by
      #3

      Both are giving same result.my requirement is the message shd be displayed on the same form,not like response.write() .It directs to different page.

      kissy

      R 1 Reply Last reply
      0
      • K Kissy16

        Both are giving same result.my requirement is the message shd be displayed on the same form,not like response.write() .It directs to different page.

        kissy

        R Offline
        R Offline
        RaviJJain
        wrote on last edited by
        #4

        u should add attributes on the button click add following code on your html page function chktxt() { if (document.getEelementById("textbox1").value='') { alert('Enter Some Value'); } } and add following code on your .vb page in page_load event button1.attributes.add("onclick","return chktxt();") check and reply me quick

        K 1 Reply Last reply
        0
        • K Kissy16

          Here i am using the following javascript for alert a msgwindow.problem is, it is opening new page and giving the message,How to alert the same in the same page??It is happening on a button click event. ---> if txt1.text="" then Response.Write(" alert(' Enter username,it shd not be null '); ") end if

          kissy

          D Offline
          D Offline
          DineshSharma
          wrote on last edited by
          #5

          Use this....enjoy :) RegisterClientScriptBlock("Alert", "alert('Purchase Invoice save successfully')");

          Dinesh Sharma Team Leader (Software Development)

          K 1 Reply Last reply
          0
          • R RaviJJain

            u should add attributes on the button click add following code on your html page function chktxt() { if (document.getEelementById("textbox1").value='') { alert('Enter Some Value'); } } and add following code on your .vb page in page_load event button1.attributes.add("onclick","return chktxt();") check and reply me quick

            K Offline
            K Offline
            Kissy16
            wrote on last edited by
            #6

            This is working perfectly. But my doubt here is,this is working for testing textboxes, If i want to display after Add_Button,i am displaying message "Records were added",here i am dipslaying with a label.In this case can i display by using script for simply " Records were added"

            kissy

            R 1 Reply Last reply
            0
            • D DineshSharma

              Use this....enjoy :) RegisterClientScriptBlock("Alert", "alert('Purchase Invoice save successfully')");

              Dinesh Sharma Team Leader (Software Development)

              K Offline
              K Offline
              Kissy16
              wrote on last edited by
              #7

              Thanks for ur answer,But both are working same,No change,any way i will use any of them Thanks once again.

              kissy

              1 Reply Last reply
              0
              • K Kissy16

                This is working perfectly. But my doubt here is,this is working for testing textboxes, If i want to display after Add_Button,i am displaying message "Records were added",here i am dipslaying with a label.In this case can i display by using script for simply " Records were added"

                kissy

                R Offline
                R Offline
                RaviJJain
                wrote on last edited by
                #8

                tell me what exactly u want!:confused:

                K 1 Reply Last reply
                0
                • R RaviJJain

                  tell me what exactly u want!:confused:

                  K Offline
                  K Offline
                  Kissy16
                  wrote on last edited by
                  #9

                  sd1 = "Insert into Producing_Agency(pa_id,pname)values(1,'"&txtname.text&"') pains = New SqlCommand(sd1, dbconn) pains.ExecuteNonQuery() Lbldisplay.Text = "Record Added" Here i am using Lbldisplay for displaying the message in the same form. can i disply by using the below in the same form , Response.Write(" alert(' Record inserted '); ") my doubt is Reposne.write means,this message is displying in other page.It directs otherpage.This is my doubt.

                  kissy

                  R 1 Reply Last reply
                  0
                  • K Kissy16

                    sd1 = "Insert into Producing_Agency(pa_id,pname)values(1,'"&txtname.text&"') pains = New SqlCommand(sd1, dbconn) pains.ExecuteNonQuery() Lbldisplay.Text = "Record Added" Here i am using Lbldisplay for displaying the message in the same form. can i disply by using the below in the same form , Response.Write(" alert(' Record inserted '); ") my doubt is Reposne.write means,this message is displying in other page.It directs otherpage.This is my doubt.

                    kissy

                    R Offline
                    R Offline
                    RaviJJain
                    wrote on last edited by
                    #10

                    No, Kissy response.write meanse writing some text on the same page as you wrote code i tried the same to my page but i got the message on the same page, it didn't redirected me any other page. i think you must check your .aspx page code. Regards Ravi :-O

                    1 Reply Last reply
                    0
                    • K Kissy16

                      Here i am using the following javascript for alert a msgwindow.problem is, it is opening new page and giving the message,How to alert the same in the same page??It is happening on a button click event. ---> if txt1.text="" then Response.Write(" alert(' Enter username,it shd not be null '); ") end if

                      kissy

                      B Offline
                      B Offline
                      Britney S Morales
                      wrote on last edited by
                      #11

                      Try using a Server side Label label1.Text = "Textbox Error"; label1.Visible = false; if(error) Label1.Visible = true; :)

                      keep Learning and you never will be out of date...

                      1 Reply Last reply
                      0
                      • K Kissy16

                        Here i am using the following javascript for alert a msgwindow.problem is, it is opening new page and giving the message,How to alert the same in the same page??It is happening on a button click event. ---> if txt1.text="" then Response.Write(" alert(' Enter username,it shd not be null '); ") end if

                        kissy

                        I Offline
                        I Offline
                        iamrashida83
                        wrote on last edited by
                        #12

                        use this: Page.RegisterStartupScript("MyScript(any script name)", "alert('Message...');"

                        Regards, Rashida Jabeen http://www.akaas.net[^]

                        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