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. messagebox in vb.net with asp.net

messagebox in vb.net with asp.net

Scheduled Pinned Locked Moved ASP.NET
csharpjavaasp-nettools
20 Posts 4 Posters 1 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.
  • S Sonia Gupta

    yes fred......message box is appearing but page is not redirceting to another page. function confirm_delete() { if (confirm("Are you sure you want to logout ?")==true) { location.href="login.aspx"; } } If (Not Page.IsPostBack) Then lnkbtnlogout.Attributes.Add("onclick", "return confirm_delete();") End If

    F Offline
    F Offline
    Fred_Smith
    wrote on last edited by
    #10

    hmm... is this button in an iframe or some such? Still, it should work... Do you have Firefox installed? Try running it under that with the Javascript console (Tools menu) opened and see if you get any error messages there. If we still can't figure it, if you want to send me the whole page (no need for the code behind just the front end) in an email I'll have a look... Fred

    S 1 Reply Last reply
    0
    • F Fred_Smith

      hmm... is this button in an iframe or some such? Still, it should work... Do you have Firefox installed? Try running it under that with the Javascript console (Tools menu) opened and see if you get any error messages there. If we still can't figure it, if you want to send me the whole page (no need for the code behind just the front end) in an email I'll have a look... Fred

      S Offline
      S Offline
      Sonia Gupta
      wrote on last edited by
      #11

      Fred...What's the mail id?

      F 1 Reply Last reply
      0
      • S Sonia Gupta

        Fred...What's the mail id?

        F Offline
        F Offline
        Fred_Smith
        wrote on last edited by
        #12

        Click the Email link (next to the Reply link) at the foot of this message

        S 1 Reply Last reply
        0
        • F Fred_Smith

          Click the Email link (next to the Reply link) at the foot of this message

          S Offline
          S Offline
          Sonia Gupta
          wrote on last edited by
          #13

          Fred it will become too large. I wanted to send the page

          F 1 Reply Last reply
          0
          • S Sonia Gupta

            Fred it will become too large. I wanted to send the page

            F Offline
            F Offline
            Fred_Smith
            wrote on last edited by
            #14

            I can't email you becasue you haven't, apparently, confirmed your email address with CP... if you just send me a blank email I can then reply to that and then you will be able to email me directly.... ! Fred

            S 1 Reply Last reply
            0
            • F Fred_Smith

              I can't email you becasue you haven't, apparently, confirmed your email address with CP... if you just send me a blank email I can then reply to that and then you will be able to email me directly.... ! Fred

              S Offline
              S Offline
              Sonia Gupta
              wrote on last edited by
              #15

              can i use the pege.registerstartupscript function?

              F 1 Reply Last reply
              0
              • S Sonia Gupta

                can i use the pege.registerstartupscript function?

                F Offline
                F Offline
                Fred_Smith
                wrote on last edited by
                #16

                I have it now: You need to "return false" from the js function to stop the linkbutton posting back the page. Presumably, even if they press Cancel you don't want to to do anything, so you can a;lways return false. In fact, if you aren't going to do any server-side processing of this utton, you could just make it an ordinary HTML button and avoid this, but anyway: try this: lnkbtnlogout.Attributes.Add("onclick", "return confirm_delete()") function confirm_delete() { if (confirm("Are you sure you want to exit ?")==true) { location.href="../login.aspx"; } return false; } Fred

                S 1 Reply Last reply
                0
                • F Fred_Smith

                  I have it now: You need to "return false" from the js function to stop the linkbutton posting back the page. Presumably, even if they press Cancel you don't want to to do anything, so you can a;lways return false. In fact, if you aren't going to do any server-side processing of this utton, you could just make it an ordinary HTML button and avoid this, but anyway: try this: lnkbtnlogout.Attributes.Add("onclick", "return confirm_delete()") function confirm_delete() { if (confirm("Are you sure you want to exit ?")==true) { location.href="../login.aspx"; } return false; } Fred

                  S Offline
                  S Offline
                  Sonia Gupta
                  wrote on last edited by
                  #17

                  Hi Fred ..... How can i use page.registerstartupstcript to do all these things in code behind file.

                  1 Reply Last reply
                  0
                  • S Sonia Gupta

                    I am using the following code of java script . it shows the messagebox , with yes and no button. now if the user click the yes button i want to redirect the present page to some other respective page. function confirm_delete() { if (confirm("Are you sure you want to delete the custom search?")==true) return true; else return false; } button.attribute.add("onclick","return confirm_delete();")

                    I Offline
                    I Offline
                    Imran Khan Pathan
                    wrote on last edited by
                    #18

                    It is very simple to do it. Just do redirect on click of Button event. function confirm_delete() { if (confirm("Are you sure you want to delete the custom search?")) return true; else return false; } BEst regard Pathan

                    GOD HELP THOSE WHO HELP THEMSELVES

                    1 Reply Last reply
                    0
                    • S Sonia Gupta

                      I am using the following code of java script . it shows the messagebox , with yes and no button. now if the user click the yes button i want to redirect the present page to some other respective page. function confirm_delete() { if (confirm("Are you sure you want to delete the custom search?")==true) return true; else return false; } button.attribute.add("onclick","return confirm_delete();")

                      C Offline
                      C Offline
                      Chetan Ranpariya
                      wrote on last edited by
                      #19

                      Hi, Implement the follwing solution. Put hyperlink button on your page and create a click event handler for it as follwing. protected void lbtn_Click(object sender, EventArgs e) { Response.Redirect(YourURL); } Write javascript function as follwing. function confirmation() { return window.confirm("Are sure u want to redirect"); } and in Page_Load write the following statement. lbtn.Attributes.Add("onclick", "javascript:return confirmation();"); I am sure this will solve your problem. Thanks and Regards, Chetan Ranpariya

                      1 Reply Last reply
                      0
                      • S Sonia Gupta

                        Fred......This is the code. function confirm_delete() { if (confirm("Are you sure you want to delete the custom search?")==true) Location.href="main.html" else return false; } Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If (Not Page.IsPostBack) Then lnkbtnlogout.Attributes.Add("onclick", "return confirm_delete();") End If End Sub

                        I Offline
                        I Offline
                        Imran Khan Pathan
                        wrote on last edited by
                        #20

                        Plz change your code here Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load lnkbtnlogout.Attributes.Add("onclick", "return confirm_delete();") instead of Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If (Not Page.IsPostBack) Then lnkbtnlogout.Attributes.Add("onclick", "return confirm_delete();") End If Coz when u click on button then javascript function will not fire.

                        GOD HELP THOSE WHO HELP THEMSELVES

                        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