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. asp.net 4.0: Using jQuery in place of UpdatePanels?

asp.net 4.0: Using jQuery in place of UpdatePanels?

Scheduled Pinned Locked Moved ASP.NET
javascriptquestioncsharpasp-netsysadmin
4 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.
  • G Offline
    G Offline
    Goalie35
    wrote on last edited by
    #1

    Hello. I'm beginning a new asp.net website (using asp.net 4.0) and I want to try implementing some better coding practices to keep the site's code "cleaner". From what I've read, updatepanel's bring along with them, a lot of unnecessary code, so my 1st plan is to avoid using them entirely. So, I was planning on using only javascript (i.e. jQuery) to handle the same functionality of that of an upatepanel but I'm unsure of how to implement this functionality. In particular, how do I get jQuery to handle the postbacks to the server in order to communicate with asp.net server side controls? Does anyone know of any tutorials on this in asp.net 4.0? I've been able to find older tutorials using asp.net 3.5 (which looks to be quite a bit of javascript code to handle the equivalent of an updatepanel), but wasn't sure if 4.0 implemented any more efficient approaches. Thanks.

    N J 2 Replies Last reply
    0
    • G Goalie35

      Hello. I'm beginning a new asp.net website (using asp.net 4.0) and I want to try implementing some better coding practices to keep the site's code "cleaner". From what I've read, updatepanel's bring along with them, a lot of unnecessary code, so my 1st plan is to avoid using them entirely. So, I was planning on using only javascript (i.e. jQuery) to handle the same functionality of that of an upatepanel but I'm unsure of how to implement this functionality. In particular, how do I get jQuery to handle the postbacks to the server in order to communicate with asp.net server side controls? Does anyone know of any tutorials on this in asp.net 4.0? I've been able to find older tutorials using asp.net 3.5 (which looks to be quite a bit of javascript code to handle the equivalent of an updatepanel), but wasn't sure if 4.0 implemented any more efficient approaches. Thanks.

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      JavaScript, or JQuery more specifically, is independent of any version or flavor of .NET, so if you find one example it should apply to all. In this situation you don't use JQuery to do any postback. You would use JQuery to make an AJAX call to a server resources, perhaps a PageMethod, then upon return, handle any page updates necessary via the DOM. This is one example, there are many more available. http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/[^]


      No comment

      1 Reply Last reply
      0
      • G Goalie35

        Hello. I'm beginning a new asp.net website (using asp.net 4.0) and I want to try implementing some better coding practices to keep the site's code "cleaner". From what I've read, updatepanel's bring along with them, a lot of unnecessary code, so my 1st plan is to avoid using them entirely. So, I was planning on using only javascript (i.e. jQuery) to handle the same functionality of that of an upatepanel but I'm unsure of how to implement this functionality. In particular, how do I get jQuery to handle the postbacks to the server in order to communicate with asp.net server side controls? Does anyone know of any tutorials on this in asp.net 4.0? I've been able to find older tutorials using asp.net 3.5 (which looks to be quite a bit of javascript code to handle the equivalent of an updatepanel), but wasn't sure if 4.0 implemented any more efficient approaches. Thanks.

        J Offline
        J Offline
        jkirkerx
        wrote on last edited by
        #3

        asp.net is not really a factor using jquery, unless you populate a control with data, and alter the data with jquery, and then try to post it back to the server. Asp.net will think that the page has been tampered with, and will generate an error. So of anything, you really have to know asp.net really well, in how it deals with postbacks. So start small with pages that don't postback or forms, and move on to as you get more confident. FYI: I got feed up with asp.net AJAX Toolkit, and decided to stop using it, replacing it with JQuery. The journey was long, but so far after 4 months of testing, it was well worth it. I get very few complaints now, and users claim that the programs are easier to use now. Actually now that I think about it, I did get rid of many update panels as well, but not for the reason you claimed. I got rid of them because I needed smoothness or animation to transition from 1 stage to another, while showing progress, but not in the form of a wheel, but in the animations themselves. This changed the users perception of nothing happening fast enough due to bandwidth restrictions to something is happening. So now I don't get the user pressing the button over and over. Here is the 10th Program I wrote with your idea, no AJAX or Update panels, pure asp.net controls and Jquery. It took 2 weeks to write, but works pretty good. I think the jquery is over 5,000 lines. [^Pure Jquery and asp.net controls from server side]

        G 1 Reply Last reply
        0
        • J jkirkerx

          asp.net is not really a factor using jquery, unless you populate a control with data, and alter the data with jquery, and then try to post it back to the server. Asp.net will think that the page has been tampered with, and will generate an error. So of anything, you really have to know asp.net really well, in how it deals with postbacks. So start small with pages that don't postback or forms, and move on to as you get more confident. FYI: I got feed up with asp.net AJAX Toolkit, and decided to stop using it, replacing it with JQuery. The journey was long, but so far after 4 months of testing, it was well worth it. I get very few complaints now, and users claim that the programs are easier to use now. Actually now that I think about it, I did get rid of many update panels as well, but not for the reason you claimed. I got rid of them because I needed smoothness or animation to transition from 1 stage to another, while showing progress, but not in the form of a wheel, but in the animations themselves. This changed the users perception of nothing happening fast enough due to bandwidth restrictions to something is happening. So now I don't get the user pressing the button over and over. Here is the 10th Program I wrote with your idea, no AJAX or Update panels, pure asp.net controls and Jquery. It took 2 weeks to write, but works pretty good. I think the jquery is over 5,000 lines. [^Pure Jquery and asp.net controls from server side]

          G Offline
          G Offline
          Goalie35
          wrote on last edited by
          #4

          Thanks for the advice. Btw, your site looks very nice. The shopping cart has a very smooth feel to it :)

          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