WorldofASP.NET : ASP.NET Directory, Tutorial, Hosting, and Source Code
You are 1 of 132 users


WorldofASP.NET >> AJAX and ATLAS >> General AJAX and ATLAS

Using AJAX UpdatePanel Control Extension

How to use AJAX UpdatePanel in a project to reload asyncronous data
Published Date : 12 May 2008
Author : Hans Candra
Language : VB.NET
Platform : .NET
Technology : Visual Studio,Ajax
Views : 2436
Rating : (0 votes so far)



Introduction

Ajax (Asynchronous JavaScript and XML), is a group of inter-related web development techniques used for creating interactive web applications. A primary characteristic is the increased responsiveness and interactivity of web pages achieved by exchanging small amounts of data with the server behind the scenes so that entire web pages do not have to be reloaded each time there is a need to fetch data from the server. This is intended to increase the web page's interactivity, speed, functionality and usability.

Ajax is asynchronous, in that extra data is requested from the server and loaded in the background without interfering with the display and behavior of the existing page. JavaScript is the scripting language in which Ajax function calls are usually made. Data is retrieved using the XMLHttpRequest object that is available to scripting languages.

Main

When you create a new ASP.NET application or web-site in VS 2008 that targets the .NET 3.5 framework, VS will automatically add the appropriate AJAX registrations in your web.config file and the core ASP.NET AJAX server controls will show up in your toolbox.

The version of ASP.NET AJAX that ships with .NET 3.5 has a number of nice improvements to it including support for using UpdatePanels with WebParts. We will explore about Update Panel that integrate with AJAX control toolkit.

Example of AJAX UpdatePanel Control
Start your Visual Studio 2008. Choose Create Web Site from the menu. In this sample application we will use the Visual Basic language for the sample application. Name the solution UpdatePanelTest. Click OK to create the project. Open Default.aspx page in design view. 

Darg and drop Update Panel and Script Manager from AJAX toolbox. Script Manager control manages client script for Microsoft ASP.NET AJAX pages. By default, the Script Manager control registers the script for the Microsoft AJAX Library with the page. This enables client script to use the type system extensions and to support features such as partial-page rendering and Web-service calls.

Now drag two labels to the design area and write the text as it is shown in below picture. Do not forget to add a button.



Double click your form and write the code in below in the Form Load event.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 
Handles Me.Load
  Label1.Text = Date.Now
  Label2.Text = Date.Now
End Sub

Run the program. Notice that the labels are filled now with the current date and time. Every time you click the button the time will change because the code is the form load event. Now, let us get back to the design mode and add an Update Panel Control from AJAX Extensions and drop it on the design page. In addition, move the second date line as well as the button into the update panel as shown in below.



Run the program again. Please note that the two dates starts the same, but whenever you click the button, only the second date is changing now. You will also notice that the page does not refresh each time you click the Button control.

When the code runs without the UpdatePanel and there is a post back event, form load will execute and change the contents of the two labels to the same date and time. When the update panel was introduced the date label as well as the button were included it. now the button will only update the controls that are within the update panel borders since it is a part of it.

Therefore, only a part of the page was sent back to the server and the controls inside the Update Panel were refreshed. 

Conclusion

An Update Panel is a control used to refresh selected parts of the page instead of refreshing the whole page with a post back. This is referred to as performing a partial-page update.


              Tag Cloud
                ajax updatepanel button   asp.net file upload progress bar   asp.net listbox control   create httpwebrequest   "javascript in asp.net"   xhtml-mp asp.net   httpmodule httphandler   httpwebrequest .net   formview displaying inserted data   tooltip asp.net   httpwebrequest in asp.net 2.0   asp.net cookie shopping cart   httpwebrequest create   asp.net pass data from one page to another   feedback form in asp.net   encrypt querystring in asp.net   asp.net url parameters   asp httpwebrequest   datalist control   asp.net httpwebrequest   form view in asp.net   smart device application   asp.net delegate   asp.net activate user   asp.net encryption   frames image gallery thumbnails asp.net   httpwebresponse   httpwebrequest   asp.net random number   generate random number asp.net   asp.net file upload progress   cannot start service from the command line or a debugger. a windows service must   edit update insert in a gridview c#   httpwebrequest httpwebresponse   checkboxlist datasource   httpwebrequest asp.net c#   asp.net cookies encryption   upload file progress bar asp.net   cannot start service from the command line or a debugger   asp.net upload ajax progress   asp.net tooltip   contact us asp.net   formview asp.net   httpwebrequest vb.net





              Other Related and Popular Articles :

              Getting Started with AJAX in ASP.NET
              This article explain about how to use AJAX in ASP.NET and also provide basic AJAX sample code


              Author Profile : Hans Candra

              Click here to view Author Profile


              How would you rate the quality of this content?
              Poor Excellent

              Comments

              Leave New Comments


              Article Content copyright by Hans Candra
              Everything else Copyright © by WorldofASP.NET 2008

              Category
              .NET 3.5
              AJAX and ATLAS
              ASP.NET
              C# Programming
              Classic ASP
              Enterprise Systems
              General .NET
              VB.NET Programming
              Announcements
              Earn Cash by writing an article or review
              For more info Click here







              Legend : - Within 3 Days - Within 6 Days - Within 9 Days

              Home | Add Resources | Sponsored Listings | Advertise with Us | SiteMap 1 | SiteMap 2 | Link To Us | Contact Us
              © 2002-2008 Worldofasp.net ASP.NET Directory, Hosting and Tutorials | All rights reserved
              Our Partners : ASP.NET Web Hosting | Windows Web Hosting | ASP.NET Hosting | Phone Card | PHP Directory | Bangkok Hotels |Calling Card