UpdatePanel.ChildrenAsTriggers 属性

定义

获取或设置一个值,该值指示来自 UpdatePanel 控件的即时子控件的回发是否更新面板的内容。Gets or sets a value that indicates whether postbacks from immediate child controls of an UpdatePanel control update the panel's content.

public:
 property bool ChildrenAsTriggers { bool get(); void set(bool value); };
public bool ChildrenAsTriggers { get; set; }
member this.ChildrenAsTriggers : bool with get, set
Public Property ChildrenAsTriggers As Boolean

属性值

Boolean

如果来自 UpdatePanel 控件的即时子控件的回发将更新面板的内容,则为 true;否则为 falsetrue if postbacks from immediate child controls of the UpdatePanel control update the panel's content; otherwise, false. 默认值为 trueThe default is true.

注解

ChildrenAsTriggers true 如果希望来自控件的直接子控件的回发 UpdatePanel 导致更新面板的内容,请将属性设置为。Set the ChildrenAsTriggers property to true if you want postbacks from immediate child controls of the UpdatePanel control to cause an update of the panel's content. UpdatePanel UpdatePanel 除非 Update 显式调用方法或将子控件定义为触发器,否则嵌套控件的子控件不会导致更新父控件的内容。Child controls of nested UpdatePanel controls will not cause an update of the parent UpdatePanel control's content unless you call the Update method explicitly or you define the child controls as triggers.

备注

UpdateMode 属性设置为 AlwaysChildrenAsTriggers 属性设置为时 false ,将 InvalidOperationException 在方法中引发异常 OnPreRenderWhen the UpdateMode property is set to Always and the ChildrenAsTriggers property is set to false, an InvalidOperationException exception is thrown during the OnPreRender method. 此属性组合不允许用于 UpdatePanel 控件。This combination of properties is not allowed for the UpdatePanel control.

ChildrenAsTriggers false 如果你有两个 UpdatePanel 控件,并且你希望从第一个面板回发来更新第二个面板的内容,但不更新其自己的内容,则可以将设置为。A scenario where you might set ChildrenAsTriggers to false is when you have two UpdatePanel controls and you want a postback from the first panel to update the content of the second panel but not update its own content. 例如,第一个面板可能是要购买的产品列表,第二个面板可能是购物车。For example, the first panel might be a list of products to buy and the second panel might be a shopping cart.

适用于

另请参阅