共用方式為


PartialCachingAttribute.VaryByControls 屬性

定義

取得輸出快取用來變更使用者控制項的使用者控制項屬性清單。

public:
 property System::String ^ VaryByControls { System::String ^ get(); };
public:
 property System::String ^ VaryByControls { System::String ^ get(); void set(System::String ^ value); };
public string VaryByControls { get; }
public string VaryByControls { get; set; }
member this.VaryByControls : string
member this.VaryByControls : string with get, set
Public ReadOnly Property VaryByControls As String
Public Property VaryByControls As String

屬性值

使用者控制項屬性的清單。

範例

下列程式碼範例示範如何將建 PartialCachingAttribute(Int32, String, String, String) 構函式套用至使用者控制項。 在此範例中,建構函式用來指出可以快取使用者控制項、將快取持續時間指定為 20 秒,以及指定名為 state 的控制項,而使用者控制項輸出將會有所不同。

// Set the PartialCachingAttribute.Duration property to
// 20 seconds and the PartialCachingAttribute.VaryByControls
// property to the ID of the server control to vary the output by.
// In this case, it is state, the ID assigned to a DropDownList
// server control.
[PartialCaching(20, null, "state", null)]
' Set the PartialCachingAttribute.Duration property to
' 20 seconds and the PartialCachingAttribute.VaryByControls
' property to the ID of the server control to vary the output by.
' In this case, it is state, the ID assigned to a DropDownList
' server control.
<PartialCaching(20, Nothing, "state", Nothing)> _
Public Class ctlSelect
    Inherits UserControl

適用於