Improve Rendering Performance for a Slow View - Agni Reddy

InfoPath Dev

Agni Reddy

Improve Rendering Performance for a Slow View

Update 2007-06-24 by Shiraz Cupala: There is a bug that affects this in InfoPath 2007 and MS has released a hotfix for it here: 


If you have any action that results in a lot of UI changes in the view then the form will become very slow. This is because repainting the entire view in InfoPath can take time. We don't know why but this happens even if you use the InfoPath OM method thisXDocument.View.DisableAutoUpdate() to turn off view autoupdating.

Some instances where form could get slow are when single button click:

  1. Inserts lot of rows in a repeating table or
  2. Makes lot of changes to show/hide fields or sections in the view.

You can improve performance by switching to another view and coming back to the initial view. But InfoPath does not allow switching views twice in single action. The following steps show how this can be done:

  1. Open a new InfoPath form in design mode.
  2. Add a new view named View 2.
  3. In View1, add a Table with Title Layout Table.
  4. Then insert a Button Control into the view and change name of the button as Switch Views.

Figure 1. View 1 with a Button Control.

  1. Double Click on the Button to open Button Properties.
  2. In the General tab click on Rules button.
  3. Click on Add button and then Add Action.
  4. Select Switch Views from Action drop-down and View 2 in View drop-down.
  5. Click OK four times to save all the changes.
  6. Select Tools -> Programming -> On Context Change Event.

Figure 2. Selecting OnContextChangeEvent.

  1. Enter the following code for OnContextChange Event handler:

function XDocument::OnContextChange(eventObj)
    if(XDocument.View.Name == "View 2")
        XDocument.View.SwitchView("View 1");

  1. Save the solution.

By adding these steps to a solution that has some slow operations, you can make it faster. This won't work in every case, but can significantly help when the issue is with view repainting.

Published Apr 24 2006, 04:55 PM by Agni Reddy
Filed under: ,


No Comments

About Agni Reddy

Agni is a Microsoft MVP. He began his InfoPath career in 2004 testing solutions developed at Qdabra™ Software and quickly transitioned to an InfoPath developer. He now has expertise developing complex InfoPath solutions. Agni holds a Master's degree in Information Systems.
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.