About Ajax and SearchUpdatePanel
The zones that can be updated are defined by the SearchUpdatePanel control. Whenever a control inside SearchUpdatePanel must be updated, the HTML for the whole content of the nearest SearchUpdatePanel is rendered, sent to the browser and then updated. A SearchUpdatePanel can contain other SearchUpdatePanel controls. When the ASP.NET request reaches the Render phase, the search interface uses different factors to build a list of panels in order to update and only the HTML for these specific panels is sent to the browser.
How the Search Interface Determines which Panels to Update
During request processing, SearchControl keeps track of several events that can cause certain controls to require an update. The following lists these events:
- A new query has been performed
- The staging settings have been modified
- The effective settings have been modified
- The Mode of the search interface has been modified
- The current result page has been modified
- The currently selected result has been modified
- A saved query or saved filter has been modified
When request processing reaches the Render phase, each SearchUpdatePanel recursively scans its children, looking for controls implementing special marker interfaces associated to the events that the SearchControl keeps track of. The available marker interfaces are:
When a control implementing one of the marker interface is found and the associated event has been raised during processing, the SearchUpdatePanel automatically schedules itself for updating. The parent SearchUpdatePanel does not access the child SearchUpdatePanel, as it assumes that it updates itself automatically.
Making Updates More Granular
In order for updates to be more granular, it is possible to add SearchUpdatePanel controls to the custom skins in order to wrap around the zones to update. No further logic is required, the search interface automatically uses these new panels when possible.
Writing New Controls Managed by SearchUpdatePanels
The updates of the custom search control developed are managed by SearchUpdatePanel. In some cases, ex.: for controls used to render information about a result (typically in result templates), the user does not manage this, as it is automatically updated when the result changes. However, if a user develops his own search controls, he must determine which event causes its rendered HTML to be updated, and implement the associated marker interfaces. Then, the control is automatically updated whenever required.
Forcing the Update of a Control in Code
It is possible to force a specific control to be updated (through the nearest SearchUpdatePanel) by calling UpdatePanel.UpdateContainingPanel and passing a reference to the control to update.