次の方法で共有


ValidatingPropertiesEventArgs.FailedProperties プロパティ

定義

検証に失敗したプロファイル プロパティを含むコレクションを取得します。

public:
 property System::Collections::ObjectModel::Collection<System::String ^> ^ FailedProperties { System::Collections::ObjectModel::Collection<System::String ^> ^ get(); };
public System.Collections.ObjectModel.Collection<string> FailedProperties { get; }
member this.FailedProperties : System.Collections.ObjectModel.Collection<string>
Public ReadOnly Property FailedProperties As Collection(Of String)

プロパティ値

検証に失敗したプロファイル プロパティ。

次の例は、 ValidatingProperties イベントのイベント ハンドラーを示しています。 FirstName プロパティに渡された値が空またはnullの場合、FirstName プロパティがFailedProperties コレクションに追加されます。

void Application_Start(object sender, EventArgs e) 
{
    System.Web.ApplicationServices.ProfileService.ValidatingProperties += new EventHandler<System.Web.ApplicationServices.ValidatingPropertiesEventArgs>(ProfileService_ValidatingProperties);
}

void ProfileService_ValidatingProperties(object sender, System.Web.ApplicationServices.ValidatingPropertiesEventArgs e)
{
    if (String.IsNullOrEmpty((string)e.Properties["FirstName"]))
    {
        e.FailedProperties.Add("FirstName");
    }
}
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    AddHandler System.Web.ApplicationServices.ProfileService.ValidatingProperties, _
      AddressOf ProfileService_ValidatingProperties
End Sub

Sub ProfileService_ValidatingProperties(ByVal sender As Object, ByVal e As System.Web.ApplicationServices.ValidatingPropertiesEventArgs)
    If (String.IsNullOrEmpty(CType(e.Properties("FirstName"), String))) Then
        e.FailedProperties.Add("FirstName")
    End If
End Sub

注釈

FailedProperties プロパティには、検証に失敗したプロパティの名前のコレクションが含まれています。 ValidatingProperties イベントのイベント ハンドラーを作成する場合は、検証に失敗したプロパティの名前を FailedProperties プロパティのコレクションに追加します。 SetPropertiesForCurrentUser メソッドは、検証に失敗したプロパティを特定できるように、FailedProperties プロパティのコレクションを返します。

適用対象