ValidatorCollection.Item[Int32] 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取 ValidatorCollection 集合中位于指定索引位置的验证服务器控件。
public:
property System::Web::UI::IValidator ^ default[int] { System::Web::UI::IValidator ^ get(int index); };
public System.Web.UI.IValidator this[int index] { get; }
member this.Item(int) : System.Web.UI.IValidator
Default Public ReadOnly Property Item(index As Integer) As IValidator
参数
- index
- Int32
要返回的验证程序的索引。
属性值
指定的验证程序的值。
示例
下面的代码示例演示了如何使用该 Item[] 属性。
// Get 'Validators' of the page to myCollection.
ValidatorCollection myCollection = Page.Validators;
// Print the values of Collection using 'Item' property.
string myStr = " ";
for(int i = 0; i<myCollection.Count; i++)
{
myStr += myCollection[i].ToString();
myStr += " ";
}
msgLabel.Text = myStr;
' Get 'Validators' of the page to myCollection.
Dim myCollection As ValidatorCollection = Page.Validators
' Print the values of Collection using 'Item' property.
Dim myStr As String = " "
Dim i As Integer
For i = 0 To myCollection.Count - 1
myStr = mystr & CType(myCollection(i),BaseValidator).ToString() & "<br />"
Next i
msgLabel.Text = myStr