Ajax Control Toolkit
DynamicPopulate Demonstration

Time at the server:

Choose a date/time format:

This time is dynamically formatted and returned as HTML from the server:

DynamicPopulate Description

DynamicPopulate is a simple extender that replaces the contents of a control with the result of a web service or page method call. The method call returns a string of HTML that is inserted as the children of the target element.

DynamicPopulate Properties

The control above is initialized with this code. The properties in italic are optional. The CustomScript or the ServiceMethod field needs to be specified.

<ajaxToolkit:DynamicPopulateExtender ID="dp" runat="server"
    UpdatingCssClass="dynamicPopulate_Updating" />
  • TargetControlID - The ID of the button or link for this extender to operate on
  • ClearContentsDuringUpdate - true (default) to clear the HTML contents of the target element when an update begins
  • ServicePath - The URL of the web service to call. Leave this parameter blank and specify a ServiceMethod to call a PageMethod. The web service should be decorated with the System.Web.Script.Services.ScriptService attribute.
  • ServiceMethod - The name of the method to call on the page or web service. The signature of this method must match the following:
    string DynamicPopulateMethod(string contextKey) { ... }
    Note you can replace "DynamicPopulateMethod" with a naming of your choice, but the return type and parameter name and type must exactly match, including case.
  • PopulateTriggerControlID - The optional name of a control that, when clicked, triggers the population of the target.
  • UpdatingCssClass - The CSS class to apply to the target during asynchronous calls.
  • CustomScript - The script to invoke instead of calling a Web or Page method. This script must evaluate to a string value.
  • ContextKey - An arbitrary string value to be passed to the web method. For example, if the element to be populated is within a data-bound repeater, this could be the ID of the current row.
  • CacheDynamicResults - Whether the results of the dynamic population should be cached and not fetched again after the first load. The default value is false.

Copyright © 2006-2009 Microsoft Corporation. All Rights Reserved.