Suggérer une traduction
 
Suggestions d'autres utilisateurs :

progress indicator
Aucune autre suggestion.
Cliquez pour évaluer et commenter
MSDN
MSDN Library
Développement .NET
.NET Framework 4
Espaces de noms System.Web
System.Web.UI.WebControls
Réduire tout/Développer tout Réduire tout
Affichage du contenu :  côte à côteAffichage du contenu : côte à côte
.NET Framework Class Library
SqlDataSourceSelectingEventArgs Class

Provides data for the Selecting event of the SqlDataSource control.

System..::.Object
  System..::.EventArgs
    System.ComponentModel..::.CancelEventArgs
      System.Web.UI.WebControls..::.SqlDataSourceCommandEventArgs
        System.Web.UI.WebControls..::.SqlDataSourceSelectingEventArgs

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)
Visual Basic
Public Class SqlDataSourceSelectingEventArgs _
    Inherits SqlDataSourceCommandEventArgs
C#
public class SqlDataSourceSelectingEventArgs : SqlDataSourceCommandEventArgs
Visual C++
public ref class SqlDataSourceSelectingEventArgs : public SqlDataSourceCommandEventArgs
F#
type SqlDataSourceSelectingEventArgs =  
    class
        inherit SqlDataSourceCommandEventArgs
    end

The SqlDataSourceSelectingEventArgs type exposes the following members.

  NameDescription
Public methodSqlDataSourceSelectingEventArgsInitializes a new instance of the SqlDataSourceSelectingEventArgs class, using the specified DbCommand object and any DataSourceSelectArguments passed to the Select method.
Top
  NameDescription
Public propertyArgumentsGets the DataSourceSelectArguments object passed to the Select method.
Public propertyCancelGets or sets a value indicating whether the event should be canceled. (Inherited from CancelEventArgs.)
Public propertyCommandGets the pending database command. (Inherited from SqlDataSourceCommandEventArgs.)
Top
  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

By adding an event handler delegate to handle the Selecting event, you can perform any additional preprocessing required or cancel the database query entirely. Because the SqlDataSourceSelectingEventArgs class is derived from the SqlDataSourceCommandEventArgs class, you can cancel a pending SqlDataSource database query by setting the Cancel property to true. You can examine and manipulate the CommandText, Parameters collection, and other database query properties prior to running the query by accessing the DbCommand object exposed by the Command property. You can also examine the DataSourceSelectArguments object that is passed to the Select method by accessing the Arguments property.

The SqlDataSourceSelectingEventArgs class is used in the OnSelecting method to provide access to a SqlDataSource database query before it is run.

The SqlDataSource control exposes many events that you can handle to work with the underlying data objects during the course of a data operation. The following table lists the events and associated EventArgs classes and event handler delegates.

Event

EventArgs

EventHandler

Selecting.

Occurs before the data is retrieved.

SqlDataSourceSelectingEventArgs

SqlDataSourceSelectingEventHandler

Inserting, Updating, and Deleting.

Occur before an insert, update, or delete operation is performed.

SqlDataSourceCommandEventArgs

SqlDataSourceCommandEventHandler

Selected, Inserted, Updated, and Deleted.

Occur after the data retrieval, insert, update, or delete operation completes.

SqlDataSourceStatusEventArgs

SqlDataSourceStatusEventHandler

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Bibliothèque de classes .NET Framework
SqlDataSourceSelectingEventArgs, classe

Fournit des données pour l'événement Selecting du contrôle SqlDataSource.

System..::.Object
  System..::.EventArgs
    System.ComponentModel..::.CancelEventArgs
      System.Web.UI.WebControls..::.SqlDataSourceCommandEventArgs
        System.Web.UI.WebControls..::.SqlDataSourceSelectingEventArgs

Espace de noms :  System.Web.UI.WebControls
Assembly :  System.Web (dans System.Web.dll)
Visual Basic
Public Class SqlDataSourceSelectingEventArgs _
    Inherits SqlDataSourceCommandEventArgs
C#
public class SqlDataSourceSelectingEventArgs : SqlDataSourceCommandEventArgs
VisualC++
public ref class SqlDataSourceSelectingEventArgs : public SqlDataSourceCommandEventArgs
F#
type SqlDataSourceSelectingEventArgs =  
    class
        inherit SqlDataSourceCommandEventArgs
    end

Le type SqlDataSourceSelectingEventArgs expose les membres suivants.

  NomDescription
Méthode publiqueSqlDataSourceSelectingEventArgsInitialise une nouvelle instance de la classe SqlDataSourceSelectingEventArgs à l'aide de l'objet DbCommand spécifié et de tous les DataSourceSelectArguments passés à la méthode Select.
Début
  NomDescription
Propriété publiqueArgumentsObtient l'objet DataSourceSelectArguments passé à la méthode Select.
Propriété publiqueCancelObtient ou définit une valeur indiquant si l'événement doit être annulé. (Hérité de CancelEventArgs.)
Propriété publiqueCommandObtient la commande de base de données en attente. (Hérité de SqlDataSourceCommandEventArgs.)
Début
  NomDescription
Méthode publiqueEquals(Object)Détermine si l'Object spécifié est égal à l'Object en cours. (Hérité de Object.)
Méthode protégéeFinalizeAutorise un objet à tenter de libérer des ressources et d'exécuter d'autres opérations de netto***ge avant qu'il ne soit récupéré par l'opération garbage collection. (Hérité de Object.)
Méthode publiqueGetHashCodeSert de fonction de hachage pour un type particulier. (Hérité de Object.)
Méthode publiqueGetTypeObtient le Type de l'instance actuelle. (Hérité de Object.)
Méthode protégéeMemberwiseCloneCrée une copie superficielle de l'objet Object actif. (Hérité de Object.)
Méthode publiqueToStringRetourne une chaîne qui représente l'objet actuel. (Hérité de Object.)
Début

En ajoutant un délégué de gestionnaire d'événements pour gérer l'événement Selecting, vous pouvez exécuter tout prétraitement supplémentaire requis ou annuler totalement la requête de base de données. La classe SqlDataSourceSelectingEventArgs étant dérivée de la classe SqlDataSourceCommandEventArgs, vous pouvez annuler une requête de base de données SqlDataSource en attente en attribuant la valeur true à la propriété Cancel. Vous pouvez examiner et manipuler CommandText, la collection Parameters et d'autres propriétés de requête de base de données avant d'exécuter la requête en accédant à l'objet DbCommand exposé par la propriété Command. Vous pouvez également examiner l'objet DataSourceSelectArguments qui est passé à la méthode Select en accédant à la propriété Arguments.

La classe SqlDataSourceSelectingEventArgs est utilisée dans la méthode OnSelecting pour fournir l'accès à une requête de base de données SqlDataSource avant qu'elle soit exécutée.

Le contrôle SqlDataSource expose beaucoup d'événements que vous pouvez gérer pour travailler avec les objets de données sous-jacents pendant le déroulement d'une opération de données. Le tableau suivant répertorie les événements et les classes EventArgs et délégués de gestionnaires d'événements associés.

Événement

EventArgs

EventHandler

Selecting.

Se produit avant la récupération des données.

SqlDataSourceSelectingEventArgs

SqlDataSourceSelectingEventHandler

Inserting, Updating, et Deleting.

Se produisent avant une opération d'insertion, de mise à jour ou de suppression.

SqlDataSourceCommandEventArgs

SqlDataSourceCommandEventHandler

Selected, Inserted, Updated et Deleted.

Se produit une fois terminées les opérations de récupération, d'insertion, de mise à jour ou de suppression des données.

SqlDataSourceStatusEventArgs

SqlDataSourceStatusEventHandler

.NET Framework

Pris en charge dans : 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, Windows XP SP2 Édition x64, Windows Server 2008 (installation minimale non prise en charge), Windows Server 2008 R2 (installation minimale prise en charge avec SP1 ou version ultérieure), Windows Server 2003 SP2

Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
Tous les membres static (Shared en Visual Basic) publics de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.
Contenu de la communauté   Qu'est-ce que le Contenu de la communauté ?
Ajouter du contenu RSS  Annotations
Processing
© 2012 Microsoft. Tous droits réservés. Conditions d'utilisation | Marques | Confidentialité
Page view tracker