loading data without a page refresh

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • athar258
    New Member
    • May 2009
    • 20

    loading data without a page refresh

    hi all,
    I am developing a web application related to the share market, what i want to accomplish is that i want to present the user share market data that will be updated every 40 seconds. but i dont want a page refresh do do that, i wanna do it the way it happens on say facebook, in which the page is updated with new contents without refreshing the page.

    somebody suggested me to use AJAX to do so. can anyone give me a starting point to achieve that, may be through ajax or something else. a simple example will be highly appreciated.

    a big thanks in advance..

    Ather
  • CroCrew
    Recognized Expert Contributor
    • Jan 2008
    • 564

    #2
    Hello athar258,

    You can’t get away from some type of call back to the web server. I understand that you don’t want to refresh the entire page every 40 seconds too.

    With that said… </ cough> AJAX UpdatePanel control </ cough>

    Happy Coding,
    CroCrew~

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      I hate it when people say "I want my page to be updated with the most current information stored on the server but I don't want to make a request to the server".

      It is impossible to get the data from the server if you don't ask the server for the data!

      Ajax is made simple for ASP.NET developers.
      Microsoft has created something called an UpdatePanel that helps you with this....so you pretty much don't have to learn Ajax in order to to perform an Asynchronous postback to the server.

      This is how it works.

      Anything in the UpdatePanel will cause an asynchronous postback to the server. So if you have a Button and a Label within the UpdatePanel and a bunch of content outside of the UpdatePanel...a nd the the user clicks the Button, only the portion of the page with the Button and the Label will be refreshed.

      Please note that the whole page is sent to the page but when the request returns to the browser it is stripped down so that only the content within the UpdatePanel is sent back.

      This means that you will have access to the controls outside of the UpdatePanel in your server side code....BUT...t hey will not be updated if you try to update them in an asynchronous postback.

      So, my suggestion is that you place whatever you want to "refresh without posting back" in side an UpdatePanel so that you can postback without the user noticing.

      Look up UpdatePanels.

      -Frinny

      Comment

      Working...