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. Post Back

Post Back

Scheduled Pinned Locked Moved ASP.NET
javascripthelpquestion
3 Posts 3 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.
  • E Offline
    E Offline
    ellllllllie
    wrote on last edited by
    #1

    Hello, I have created a web user control and that contain a javascript method that check for required field. if there is a required filed not filled it return an alert. the problem is that the page post back not in the control pageload but the page that contain that control. how can i prevent from post back when a special field is required. regards.

    dghdfghdfghdfghdgh

    T A 2 Replies Last reply
    0
    • E ellllllllie

      Hello, I have created a web user control and that contain a javascript method that check for required field. if there is a required filed not filled it return an alert. the problem is that the page post back not in the control pageload but the page that contain that control. how can i prevent from post back when a special field is required. regards.

      dghdfghdfghdfghdgh

      T Offline
      T Offline
      tagyurit
      wrote on last edited by
      #2

      To call a javascript function prior to postback, take the button out of the form. Use the button to call javascript, and if everything is ok, use the javascript to call form.submit(). Rob http://tagyurit.com

      r

      1 Reply Last reply
      0
      • E ellllllllie

        Hello, I have created a web user control and that contain a javascript method that check for required field. if there is a required filed not filled it return an alert. the problem is that the page post back not in the control pageload but the page that contain that control. how can i prevent from post back when a special field is required. regards.

        dghdfghdfghdfghdgh

        A Offline
        A Offline
        Abhishek Sur
        wrote on last edited by
        #3

        use onclick = "return yourfunction()" Now from the function return false when you show the alert, the page will then not be posted back. :)

        function yourfunction()
        {
        if ...
        {
        alert('invalid');
        return false;
        }
        return true;
        }

        :thumbsup:

        Abhishek Sur


        My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

        **Don't forget to click "Good Answer" if you like to.

        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