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

适用于