UpdatePanel.ChildrenAsTriggers UpdatePanel.ChildrenAsTriggers UpdatePanel.ChildrenAsTriggers UpdatePanel.ChildrenAsTriggers Property


取得或設定值,這個值表示來自 UpdatePanel 控制項之下層子控制項的回傳是否會更新面板內容。Gets or sets a value that indicates whether postbacks from immediate child controls of an UpdatePanel control update the panel's content.

 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


如果來自 UpdatePanel 控制項之下層子控制項的回傳會更新面板內容,則為 true,否則為 falsetrue if postbacks from immediate child controls of the UpdatePanel control update the panel's content; otherwise, false. 預設為 trueThe default is true.


如果您想要trueUpdatePanel控制項的直屬子控制項回傳, 使面板內容的更新, 請將屬性設定為。ChildrenAsTriggersSet 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呼叫Update方法, 或將子控制項定義為UpdatePanel觸發程式, 否則嵌套控制項的子控制項將不會更新父控制項的內容。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.


Always false當屬性設定OnPreRender為且ChildrenAsTriggers屬性設定為時, InvalidOperationException會在方法期間擲回例外狀況。 UpdateModeWhen 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 UpdatePanel控制項, false而且您想要從第一個面板回傳以更新第二個面板的內容, 但未更新其本身的內容時, 您可能會將設為。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.