Can you explain Enablepartialrendering and UpdatePanel control in Ajax?

 Posted by ArticlesMaint on 10/1/2009 | Category: ASP.NET AJAX Interview questions | Views: 14973

Let’s answer the above questions with a simple sample Ajax application. As we move through this application we will be answering the above questions. If you have already installed the Ajax setup and added the reference to ‘Microsoft.Web.Atlas.dll’ you should see those controls in your tool box as shown in the above figure ‘Ajax controls’. Let’s follow the below steps to complete this sample:

  • So first drag and drop ‘ScriptManager’ control from the tool box on the ASPX page. We have already discussed in the previous question how important a ‘ScriptManager’ control. In order to ensure that the full page does not post back we need to make ‘EnablePartialRendering’ to true. If this is false then the full page will refresh.

  • Now drag the ‘UpdatePanel’ control from the tool box on the ASPX page. Using ‘UpdatePanel’ we can restrict the area of post back. In normal ASPX pages the whole page posts back i.e. there is a full refresh. But by using ‘UpdatePanel’ we define which area has to be refreshed. ‘UpdatePanel’ forms a container for controls and thus defining the area of post back.

  • Now we drag two controls a button and textbox and put a long loop code as shown in figure ‘Long loop code’.

Below figure ‘ScriptManager and UpdatePanel' shows how the ‘ScriptManager’, ‘UpdatePanel’ and ‘EnablePartialRendering’ will look like.

Figure 18.9 : - ScriptManager and UpdatePanel

Figure 18.10: - Long loop code

Just to understand the inside basics you can switch in to the HTML of the ASPX you should see the below code snippet as shown in figure ‘ScriptManager and UpdatePanel code view’.

Note: - ‘ScriptManager’ should come as a first control on any Ajax ASPX page.


  • 1 -> Defines the ‘ScriptManager’ control,

  • 2 -> Defines the ‘UpdatePanel’ control,

  • 3 -> all the controls should come under ‘ContentTemplate’ tag and

  • 4 -> defines the controls which will be wrapped under the ‘UpdatePanel’ tag. Figure ‘Long loop code’ is called on button1 click to do some heavy task so that we can judge the advantage of using Ajax.

Figure 18.11: - Script Manager and Update Panel code view

Once done you can check the project with ‘EnableRenderingtrue and with false value to see the effect of how Ajax actually works.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response