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. problem in alert

problem in alert

Scheduled Pinned Locked Moved ASP.NET
help
12 Posts 6 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 Offline
    J Offline
    janani13
    wrote on last edited by
    #1

    Hi all, I want to redirect the page after alert box is clicked . but the page redirects before the alert was called Wat to do..

    L B 2 Replies Last reply
    0
    • J janani13

      Hi all, I want to redirect the page after alert box is clicked . but the page redirects before the alert was called Wat to do..

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      can you paste the code that is redirecting the page and displaying alert

      Regards Aman Bhullar www.arlivesupport.com[^]

      1 Reply Last reply
      0
      • J janani13

        Hi all, I want to redirect the page after alert box is clicked . but the page redirects before the alert was called Wat to do..

        B Offline
        B Offline
        Blue_Boy
        wrote on last edited by
        #3

        You should use javascript,fire function name from your control.

        function ShowAlert()
        {
        alert('You will redirect in another page');
        window.open(' yoururladdress/pagename.aspx');
        }

        onclick="ShowAlert()"


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

        J 1 Reply Last reply
        0
        • B Blue_Boy

          You should use javascript,fire function name from your control.

          function ShowAlert()
          {
          alert('You will redirect in another page');
          window.open(' yoururladdress/pagename.aspx');
          }

          onclick="ShowAlert()"


          I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

          J Offline
          J Offline
          janani13
          wrote on last edited by
          #4

          This is wat i used but the page is redirected without waiting for alert box.

          B S 2 Replies Last reply
          0
          • J janani13

            This is wat i used but the page is redirected without waiting for alert box.

            B Offline
            B Offline
            Blue_Boy
            wrote on last edited by
            #5

            Which control you are using to redirect in another page? If you are using button then use property

            OnClientClick="ShowAlert(); return false;"


            I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

            J 1 Reply Last reply
            0
            • B Blue_Boy

              Which control you are using to redirect in another page? If you are using button then use property

              OnClientClick="ShowAlert(); return false;"


              I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

              J Offline
              J Offline
              janani13
              wrote on last edited by
              #6

              I have validation one the control.Now validation is not working..

              C 1 Reply Last reply
              0
              • J janani13

                I have validation one the control.Now validation is not working..

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                Your core problem is that you think we're mind readers. Your code is broken. We can't fix it without seeing it.

                Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

                J 1 Reply Last reply
                0
                • C Christian Graus

                  Your core problem is that you think we're mind readers. Your code is broken. We can't fix it without seeing it.

                  Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

                  J Offline
                  J Offline
                  janani13
                  wrote on last edited by
                  #8

                  This is the code at client side

                  function changed() {
                  alert('Password changed successfully');
                  window.open("UserProfile.aspx");
                  return false;
                  }

                  I called it at the server side as

                  Page.RegisterStartupScript("Error", "changed()");
                  Response.Redirect("UserProfile.aspx");

                  inside the click event of the button.That button will cause validation also. My problem is the page is redirected before alert is clicked.

                  L P C 3 Replies Last reply
                  0
                  • J janani13

                    This is wat i used but the page is redirected without waiting for alert box.

                    S Offline
                    S Offline
                    saanj
                    wrote on last edited by
                    #9

                    Post the code which you are using. Code shared by Blue Boy should definitely work.

                    There is no foolish question, there is no final answer...

                    1 Reply Last reply
                    0
                    • J janani13

                      This is the code at client side

                      function changed() {
                      alert('Password changed successfully');
                      window.open("UserProfile.aspx");
                      return false;
                      }

                      I called it at the server side as

                      Page.RegisterStartupScript("Error", "changed()");
                      Response.Redirect("UserProfile.aspx");

                      inside the click event of the button.That button will cause validation also. My problem is the page is redirected before alert is clicked.

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      According to me, the code should redirect to Default.aspx not UserProfile.aspx. In server side code, you register the client script block and then you redirected it to Default.aspx. You comment the Response.Redirect, it will start redirecting to UserProfile Page

                      Regards Aman Bhullar www.arlivesupport.com[^]

                      1 Reply Last reply
                      0
                      • J janani13

                        This is the code at client side

                        function changed() {
                        alert('Password changed successfully');
                        window.open("UserProfile.aspx");
                        return false;
                        }

                        I called it at the server side as

                        Page.RegisterStartupScript("Error", "changed()");
                        Response.Redirect("UserProfile.aspx");

                        inside the click event of the button.That button will cause validation also. My problem is the page is redirected before alert is clicked.

                        P Offline
                        P Offline
                        Paddy Boyd
                        wrote on last edited by
                        #11

                        Yes, that's always going to be the case - why don't you put your redirection into the javascript function as well...

                        1 Reply Last reply
                        0
                        • J janani13

                          This is the code at client side

                          function changed() {
                          alert('Password changed successfully');
                          window.open("UserProfile.aspx");
                          return false;
                          }

                          I called it at the server side as

                          Page.RegisterStartupScript("Error", "changed()");
                          Response.Redirect("UserProfile.aspx");

                          inside the click event of the button.That button will cause validation also. My problem is the page is redirected before alert is clicked.

                          C Offline
                          C Offline
                          Christian Graus
                          wrote on last edited by
                          #12

                          anu_anu wrote:

                          Page.RegisterStartupScript("Error", "changed()");

                          This injects script into the page.

                          anu_anu wrote:

                          Response.Redirect("UserProfile.aspx");

                          This redirects, so that your page is never rendered.

                          Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

                          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