Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

AsyncPostBackTrigger Class

Defines a control and optional event of the control as an asynchronous postback control trigger that causes the UpdatePanel control to refresh.

Syntax

CSharp

VisualBasic

<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public Class AsyncPostBackTrigger _
	Inherits UpdatePanelControlTrigger

ManagedCPlusPlus

[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)]
public ref class AsyncPostBackTrigger : public UpdatePanelControlTrigger

JSharp

/** @attribute AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal) */
/** @attribute AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal) */
public class AsyncPostBackTrigger extends UpdatePanelControlTrigger

Members

IconMemberDescription
AsyncPostBackTriggerNew()Initializes a new instance of an AsyncPostBackTrigger class.
ControlIDGets or sets the name of the control that is an AsyncPostBackTrigger for an UpdatePanel control. (Overrides UpdatePanelControlTrigger.ControlID.)
Equals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
EventNameGets or sets the postback control event that will trigger an UpdatePanel control to be updated.
Finalize()Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
FindTargetControl(Boolean)Searches for the control specified in the ControlID property. (Inherited from UpdatePanelControlTrigger.)
GetHashCode()Serves as a hash function for a particular type. (Inherited from Object.)
GetType()Gets the Type of the current instance. (Inherited from Object.)
HasTriggered()Returns a Boolean value that indicates whether the trigger was fired. (Overrides UpdatePanelTrigger.HasTriggered().)
Initialize()Initializes the AsyncPostBackTrigger control and checks that the event named in the trigger exists and is valid. (Overrides UpdatePanelTrigger.Initialize().)
MemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
OnEvent(Object, EventArgs)Raises the event that will trigger an UpdatePanel control to be updated.
OwnerGets a reference to the UpdatePanel control that the UpdatePanelTrigger targets. (Inherited from UpdatePanelTrigger.)
ToString()Returns a String that represents the current AsyncPostBackTrigger control. (Overrides Object.ToString().)

Remarks

Use the AsyncPostBackTrigger control to enable controls to be triggers for an UpdatePanel control. Controls that are triggers for an update panel cause a refresh of the panel's content when they post back. An AsyncPostBackTrigger is useful for controls in the following scenarios:

  • For controls that are outside a panel to cause a panel refresh.

  • For controls that are inside a panel when the ChildrenAsTriggers property is false to cause a panel refresh.

  • For controls that are inside nested panels to cause a refresh of parent panels.

The control that the AsyncPostBackTrigger references must be in the same naming container as the update panel for which it is a trigger. Triggers that are based on controls in other naming containers are not supported.

Add AsyncPostBackTrigger controls either by using the UpdatePanelTrigger Collection Editor dialog box in the designer or by creating a <Triggers> element declaratively in the UpdatePanel control. The ControlID property is required, but the EventName property is optional. If the EventName property is not specified, the DefaultEventAttribute of the control is used to determine the default event. For example, the default event for the Button control is the Click event. The EventName property is case-insensitive.

You can also reference a naming container as a trigger. In this case, all child controls in the container that cause a postback will be considered triggers for the UpdatePanel.

Programmatically adding AsyncPostBackTrigger controls is not supported. Use the RegisterAsyncPostBackControl(Control) method of the ScriptManager control to programmatically register a postback control, and then call the Update() method of the UpdatePanel when the control posts back.

An exception will occur if you define a control as both a PostBackTrigger and an AsyncPostBackTrigger.

Examples

The following example demonstrates how to add an AsyncPostBackTrigger declaratively. A Button control that is outside an UpdatePanel control lets users enter a search term to find in the Products table of the Northwind database. A GridView control that is inside the UpdatePanel control shows the results. The Button is specified as an AsyncPostBackTrigger for the UpdatePanel control.

Permissions

  • AspNetHostingPermission

    for operating in a hosted environment. Demand value: LinkDemand. Permission value: Minimal.

  • AspNetHostingPermission

    for operating in a hosted environment. Demand value: InheritanceDemand. Permission value: Minimal.

Inheritance Hierarchy

Assembly: System.Web.Extensions (Module: System.Web.Extensions)