.NET Framework Class Library QueryExtender Class Enables data from a data source to be filtered without an explicit Where clause in the data source.

Inheritance Hierarchy
Namespace:
System.Web.UI.WebControls
Assembly:
System.Web.Extensions (in System.Web.Extensions.dll)

Syntax
<ToolboxBitmapAttribute(GetType(QueryExtender), "QueryExtender.bmp")> _
Public Class QueryExtender _
Inherits Control
[ToolboxBitmapAttribute(typeof(QueryExtender), "QueryExtender.bmp")]
public class QueryExtender : Control
[ToolboxBitmapAttribute(typeof(QueryExtender), L"QueryExtender.bmp")]
public ref class QueryExtender : public Control
[<ToolboxBitmapAttribute(typeof(QueryExtender), "QueryExtender.bmp")>]
type QueryExtender =
class
inherit Control
end
The QueryExtender type exposes the following members.

Constructors
|
| Name | Description |
|---|
.gif) | QueryExtender | Initializes a new instance of the QueryExtender Class. | Top

Methods
|
| Name | Description |
|---|
.gif) | AddedControl | Called after a child control is added to the Controls collection of the Control object. (Inherited from Control.) | .gif) | AddParsedSubObject | Notifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's ControlCollection object. (Inherited from Control.) | .gif) | ApplyStyleSheetSkin | Applies the style properties defined in the page style sheet to the control. (Inherited from Control.) | .gif) | BuildProfileTree | Infrastructure. Gathers information about the server control and delivers it to the Trace property to be displayed when tracing is enabled for the page. (Inherited from Control.) | .gif) | ClearCachedClientID | Infrastructure. Sets the cached ClientID value to nullNothingnullptra null reference (Nothing in Visual Basic). (Inherited from Control.) | .gif) | ClearChildControlState | Deletes the control-state information for the server control's child controls. (Inherited from Control.) | .gif) | ClearChildState | Deletes the view-state and control-state information for all the server control's child controls. (Inherited from Control.) | .gif) | ClearChildViewState | Deletes the view-state information for all the server control's child controls. (Inherited from Control.) | .gif) | ClearEffectiveClientIDMode | Infrastructure. Sets the ClientIDMode property of the current control instance and of any child controls to Inherit. (Inherited from Control.) | .gif) | CreateChildControls | Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. (Inherited from Control.) | .gif) | CreateControlCollection | Creates a new ControlCollection object to hold the child controls (both literal and server) of the server control. (Inherited from Control.) | .gif) | DataBind()()() | Binds a data source to the invoked server control and all its child controls. (Inherited from Control.) | .gif) | DataBind(Boolean) | Binds a data source to the invoked server control and all its child controls with an option to raise the DataBinding event. (Inherited from Control.) | .gif) | DataBindChildren | Binds a data source to the server control's child controls. (Inherited from Control.) | .gif) | Dispose | Enables a server control to perform final clean up before it is released from memory. (Inherited from Control.) | .gif) | EnsureChildControls | Determines whether the server control contains child controls. If it does not, it creates child controls. (Inherited from Control.) | .gif) | EnsureID | Creates an identifier for controls that do not have an identifier assigned. (Inherited from Control.) | .gif) | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | .gif) | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | .gif) | FindControl(String) | Searches the current naming container for a server control with the specified id parameter. (Inherited from Control.) | .gif) | FindControl(String, Int32) | Infrastructure. Searches the current naming container for a server control with the specified id and an integer, specified in the pathOffset parameter, which aids in the search. You should not override this version of the FindControl method. (Inherited from Control.) | .gif) | Focus | Sets input focus to a control. (Inherited from Control.) | .gif) | GetDesignModeState | Infrastructure. Gets design-time data for a control. (Inherited from Control.) | .gif) | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | .gif) | GetRouteUrl(Object) | Gets the URL that corresponds to a set of route parameters. (Inherited from Control.) | .gif) | GetRouteUrl(RouteValueDictionary) | Gets the URL that corresponds to a set of route parameters. (Inherited from Control.) | .gif) | GetRouteUrl(String, Object) | Gets the URL that corresponds to a set of route parameters and a route name. (Inherited from Control.) | .gif) | GetRouteUrl(String, RouteValueDictionary) | Gets the URL that corresponds to a set of route parameters and a route name. (Inherited from Control.) | .gif) | GetType | Gets the Type of the current instance. (Inherited from Object.) | .gif) | GetUniqueIDRelativeTo | Returns the prefixed portion of the UniqueID property of the specified control. (Inherited from Control.) | .gif) | HasControls | Determines if the server control contains any child controls. (Inherited from Control.) | .gif) | HasEvents | Returns a value indicating whether events are registered for the control or any child controls. (Inherited from Control.) | .gif) | IsLiteralContent | Infrastructure. Determines if the server control holds only literal content. (Inherited from Control.) | .gif) | LoadControlState | Restores control-state information from a previous page request that was saved by the SaveControlState method. (Inherited from Control.) | .gif) | LoadViewState | Loads the state of the values in the QueryExtender control that must be persisted. (Overrides Control..::.LoadViewState(Object).) | .gif) | MapPathSecure | Retrieves the physical path that a virtual path, either absolute or relative, maps to. (Inherited from Control.) | .gif) | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | .gif) | OnBubbleEvent | Determines whether the event for the server control is passed up the page's UI server control hierarchy. (Inherited from Control.) | .gif) | OnDataBinding | Raises the DataBinding event. (Inherited from Control.) | .gif) | OnInit | Occurs when a new instance of the QueryExtender class is initialized. (Overrides Control..::.OnInit(EventArgs).) | .gif) | OnLoad | Raises the Load event. (Inherited from Control.) | .gif) | OnPreRender | Raises the PreRender event. (Inherited from Control.) | .gif) | OnUnload | Raises the Unload event. (Inherited from Control.) | .gif) | OpenFile | Gets a Stream used to read a file. (Inherited from Control.) | .gif) | RaiseBubbleEvent | Assigns any sources of the event and its information to the control's parent. (Inherited from Control.) | .gif) | RemovedControl | Called after a child control is removed from the Controls collection of the Control object. (Inherited from Control.) | .gif) | Render | Sends server control content to a provided HtmlTextWriter object, which writes the content to be rendered on the client. (Inherited from Control.) | .gif) | RenderChildren | Outputs the content of a server control's children to a provided HtmlTextWriter object, which writes the content to be rendered on the client. (Inherited from Control.) | .gif) | RenderControl(HtmlTextWriter) | Outputs server control content to a provided HtmlTextWriter object and stores tracing information about the control if tracing is enabled. (Inherited from Control.) | .gif) | RenderControl(HtmlTextWriter, ControlAdapter) | Outputs server control content to a provided HtmlTextWriter object using a provided ControlAdapter object. (Inherited from Control.) | .gif) | ResolveAdapter | Gets the control adapter responsible for rendering the specified control. (Inherited from Control.) | .gif) | ResolveClientUrl | Gets a URL that can be used by the browser. (Inherited from Control.) | .gif) | ResolveUrl | Converts a URL into one that is usable on the requesting client. (Inherited from Control.) | .gif) | SaveControlState | Saves any server control state changes that have occurred since the time the page was posted back to the server. (Inherited from Control.) | .gif) | SaveViewState | Saves the current view state of the QueryExtender control. (Overrides Control..::.SaveViewState()()().) | .gif) | SetDesignModeState | Sets design-time data for a control. (Inherited from Control.) | .gif) | SetRenderMethodDelegate | Infrastructure. Assigns an event handler delegate to render the server control and its content into its parent control. (Inherited from Control.) | .gif) | ToString | Returns a string that represents the current object. (Inherited from Object.) | .gif) | TrackViewState | Tracks view-state changes of the QueryExtender control so that the changes can be stored in the StateBag object for the control. (Overrides Control..::.TrackViewState()()().) | Top

Extension Methods

Explicit Interface Implementations
|
| Name | Description |
|---|
.gif) .gif) | IControlBuilderAccessor..::.ControlBuilder | For a description of this member, see IControlBuilderAccessor..::.ControlBuilder. (Inherited from Control.) | .gif) .gif) | IControlDesignerAccessor..::.GetDesignModeState | For a description of this member, see IControlDesignerAccessor..::.GetDesignModeState. (Inherited from Control.) | .gif) .gif) | IControlDesignerAccessor..::.SetDesignModeState | For a description of this member, see IControlDesignerAccessor..::.SetDesignModeState. (Inherited from Control.) | .gif) .gif) | IControlDesignerAccessor..::.SetOwnerControl | Infrastructure. For a description of this member, see IControlDesignerAccessor..::.SetOwnerControl. (Inherited from Control.) | .gif) .gif) | IControlDesignerAccessor..::.UserData | For a description of this member, see IControlDesignerAccessor..::.UserData. (Inherited from Control.) | .gif) .gif) | IDataBindingsAccessor..::.DataBindings | For a description of this member, see IDataBindingsAccessor..::.DataBindings. (Inherited from Control.) | .gif) .gif) | IDataBindingsAccessor..::.HasDataBindings | For a description of this member, see IDataBindingsAccessor..::.HasDataBindings. (Inherited from Control.) | .gif) .gif) | IExpressionsAccessor..::.Expressions | For a description of this member, see IExpressionsAccessor..::.Expressions. (Inherited from Control.) | .gif) .gif) | IExpressionsAccessor..::.HasExpressions | For a description of this member, see IExpressionsAccessor..::.HasExpressions. (Inherited from Control.) | .gif) .gif) | IParserAccessor..::.AddParsedSubObject | For a description of this member, see IParserAccessor..::.AddParsedSubObject. (Inherited from Control.) | Top

Remarks
In this topic: IntroductionThe QueryExtender control is used to create filters for data that is retrieved from a data source, without using an explicit Where clause in the data source. The QueryExtender control can be used to specify filtering by using declarative syntax. BackgroundFiltering excludes data from a data source by displaying only the records that meet specified criteria. Filtering enables you to present different views of the data that is in a data set without affecting the data in the data set. Filtering typically requires that you create a Where clause to apply to the command that queries the data source. However, the Where property of the data source control might not expose the full functionality that is available. For example, the QueryExtender control enables you to query a table by searching for strings at the beginning, end or anywhere in .data field. To expose the full functionality that is available in LINQ and to make filtering data easier, ASP.NET provides the QueryExtender control. The QueryExtender control has the following benefits: It provides a richer filtering experience than writing a Where clause. For example, you can search a Products table for Boolean values by using the PropertyExpression filter without writing a query. It lets you specify filters by using the same syntax for the LinqDataSource and EntityDataSource controls and for any other data source controls that you might use. It can be used with LinqDataSource control, with a EntityDataSource control, or with third-party data sources.
Filter OptionsThe QueryExtender control supports a variety of options that you can use to filter data. The control lets you search strings, search numeric values in a specified range, and compare a property value in a table to a specified value. The control also lets you sort the data and provide custom queries. These options are provided as LINQ expressions in the QueryExtender control. The QueryExtender control also supports expressions that are specific to ASP.NET Dynamic Data applications. The following table lists the options that you can use to filter data in the QueryExtender control. You can use these QueryExtender options individually or you can combine them to provide complex filtering in a Web page. For more information, see QueryExtender Web Server Control Overview. Walkthrough: Filtering Data in a Web Page Using Declarative Syntax TasksThe following table lists tasks that show how to use the QueryExtender control to filter data. Declarative Syntax
<asp:QueryExtender
EnableViewState="True|False"
ID="string"
OnDataBinding="DataBiding event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler
OnLoad="Load event handler"
OnPreRender="PreRender event handler"
OnUnload="UnLoad event hadler"
Runat="server"
TargetControlID="string"
Visible="True|False"
>
<asp:ControlFilterExpression
ControlD="string"
Column="string">
</asp:ControlFilterExpression>
<asp:DynamicFilterExpression
ControlD="string"
</asp:DynamicFilterExpression>
<asp:CustomExpression="string"
OnQuerying="OnQerying event handler">
</asp:CustomExpression>
<asp:OrderByExpression="string"
DataField="string"
Direction="string">
<asp:ThenByExpression
DataField="string"
Direction="string"
</asp:ThenBy>
</asp:OrderByExpression>
<asp:PropertyExpression="string">
<!-- child controls -->
</asp:PropertyExpression
>
<asp:RangeExpression="integer"
Datafield="string"
MaxType="Exclusive|Inclusive|None"
MinType="Exclusive|Inclusive|None">
<!--child controls-->
</asp:RangeExpression>
<asp:SearchExpression="string"
ComparisonType="CurrentCulture|CurrentCultureIgnoreCase|
InavariantCulture|InvariantCultureIgnoreCase|
Ordinal|OrdinalIgnoreCase"
DataField="string"
SearchType="Contains|EndsWith|StartsWith">
<!--child controls-->
</asp:SearchExpression>
</asp:QueryExtender>

Examples
The following example shows how to use the QueryExtender control to provide a search function in a Web page. The QueryExtender control uses the text that is entered in the TextBoxSearch control to search for contents in the ProductName and Supplier.CompanyName columns of a Products table in the data that is returned from the LinqDataSource control. The SearchExpression object is used to perform the search. The DataFields property specifies the data fields to search. The SearchType property specifies the type of search to perform. The ControlParameter element specifies the control that contains the text to use for the search. This code example is part of a larger example that is provided in Walkthrough: Filtering Data in a Web Page Using Declarative Syntax.
<asp:LinqDataSource ID="dataSource" runat="server"
TableName="Products">
</asp:LinqDataSource>
<asp:QueryExtender TargetControlID="dataSource" runat="server">
<asp:SearchExpression DataFields="ProductName, Supplier.CompanyName"
SearchType="StartsWith">
<asp:ControlParameter ControlID="TextBoxSearch" />
</asp:SearchExpression>
</asp:QueryExtender>
The following example shows how to use the QueryExtender control to search a Web page for values in a specified range. The QueryExtender control uses the values that are entered in the TextBoxFrom and TextBoxTo controls to search for values in the ProductName and Supplier.CompanyName columns of a Products table in the data that is returned from the LinqDataSource control. The ControlParameter element specifies the text box controls that contain the minimum and maximum values to use for searching the range. The MinType and MaxType properties specify that the minimum and maximum values must be included in the data that is returned. This code example is part of a larger example provided in Walkthrough: Filtering Data in a Web Page Using Declarative Syntax.
<asp:LinqDataSource ID="dataSource" runat="server"
TableName="Products">
</asp:LinqDataSource>
<asp:QueryExtender TargetControlID="dataSource" runat="server">
<asp:RangeExpression DataField="UnitPrice" MinType="Inclusive"
MaxType="Inclusive">
<asp:ControlParameter ControlID="TextBoxFrom" />
<asp:ControlParameter ControlID="TexBoxTo" />
</asp:RangeExpression>
</asp:QueryExtender>

Version Information
.NET FrameworkSupported in: 4

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, 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.

Thread Safety
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also
|
Bibliothèque de classes .NET Framework QueryExtender, classe Active les données d'une source de données à filtrer sans clause Where explicite dans la source de données.

Hiérarchie d'héritage
Espace de noms :
System.Web.UI.WebControls
Assembly :
System.Web.Extensions (dans System.Web.Extensions.dll)

Syntaxe
<ToolboxBitmapAttribute(GetType(QueryExtender), "QueryExtender.bmp")> _
Public Class QueryExtender _
Inherits Control
[ToolboxBitmapAttribute(typeof(QueryExtender), "QueryExtender.bmp")]
public class QueryExtender : Control
[ToolboxBitmapAttribute(typeof(QueryExtender), L"QueryExtender.bmp")]
public ref class QueryExtender : public Control
[<ToolboxBitmapAttribute(typeof(QueryExtender), "QueryExtender.bmp")>]
type QueryExtender =
class
inherit Control
end
Le type QueryExtender expose les membres suivants.

Constructeurs
|
| Nom | Description |
|---|
.gif) | QueryExtender | Initialise une nouvelle instance de la classe QueryExtender. | Début

Méthodes
|
| Nom | Description |
|---|
.gif) | AddedControl | Appelée après l'ajout d'un contrôle enfant à la collection Controls de l'objet Control. (Hérité de Control.) | .gif) | AddParsedSubObject | Avertit le contrôle serveur qu'un élément XML ou HTML a été analysé et l'ajoute à l'objet ControlCollection du contrôle serveur. (Hérité de Control.) | .gif) | ApplyStyleSheetSkin | Applique les propriétés de style définies dans la feuille de style de la page au contrôle. (Hérité de Control.) | .gif) | BuildProfileTree | Infrastructure. Collecte des informations sur le contrôle serveur et les livre à la propriété Trace à afficher lorsque le traçage est activé pour la page. (Hérité de Control.) | .gif) | ClearCachedClientID | Infrastructure. Affecte à la valeur ClientID mise en cache la valeur nullNothingnullptrune référence null (Nothing en Visual Basic). (Hérité de Control.) | .gif) | ClearChildControlState | Supprime les informations sur l'état du contrôle des contrôles enfants du contrôle serveur. (Hérité de Control.) | .gif) | ClearChildState | Supprime les informations sur l'état d'affichage et sur l'état du contrôle de tous les contrôles enfants du contrôle serveur. (Hérité de Control.) | .gif) | ClearChildViewState | Supprime les informations d'état d'affichage de tous les contrôles enfants du contrôle serveur. (Hérité de Control.) | .gif) | ClearEffectiveClientIDMode | Infrastructure. Affecte la valeur Inherit à la propriété ClientIDMode de l'instance de contrôle actuelle et de tous contrôles enfants. (Hérité de Control.) | .gif) | CreateChildControls | Appelé par l'infrastructure de page ASP.NET pour avertir les contrôles serveur qui utilisent une implémentation basée sur la composition qu'ils doivent créer tous les contrôles enfants qu'ils contiennent en préparation de la publication ou du rendu. (Hérité de Control.) | .gif) | CreateControlCollection | Crée un nouvel objet ControlCollection pour contenir les contrôles enfants (littéraux et serveur) du contrôle serveur. (Hérité de Control.) | .gif) | DataBind()()() | Lie une source de données au contrôle serveur appelé et à tous ses contrôles enfants. (Hérité de Control.) | .gif) | DataBind(Boolean) | Lie une source de données au contrôle serveur appelé et tous ses contrôles enfants avec une option pour déclencher l'événement DataBinding. (Hérité de Control.) | .gif) | DataBindChildren | Lie une source de données aux contrôles enfants du contrôle serveur. (Hérité de Control.) | .gif) | Dispose | Permet à un contrôle serveur d'effectuer le nettoyage final avant qu'il soit libéré de la mémoire. (Hérité de Control.) | .gif) | EnsureChildControls | Détermine si le contrôle serveur contient des contrôles enfants. S'il ne contient pas de contrôles enfants, il en crée. (Hérité de Control.) | .gif) | EnsureID | Crée un identificateur pour les contrôles auxquels aucun identificateur n'est assigné. (Hérité de Control.) | .gif) | Equals(Object) | Détermine si l'Object spécifié est égal à l'Object en cours. (Hérité de Object.) | .gif) | Finalize | Autorise 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.) | .gif) | FindControl(String) | Recherche un contrôle serveur possédant le paramètre id spécifié dans le conteneur d'attribution de noms actuel. (Hérité de Control.) | .gif) | FindControl(String, Int32) | Infrastructure. Recherche le conteneur d'attribution de noms actuel d'un contrôle serveur avec l'id spécifié et un entier, spécifié dans le paramètre pathOffset, qui facilite la recherche. Vous ne devez pas substituer cette version de la méthode FindControl. (Hérité de Control.) | .gif) | Focus | Affecte le focus d'entrée à un contrôle. (Hérité de Control.) | .gif) | GetDesignModeState | Infrastructure. Obtient les données au moment du design pour un contrôle. (Hérité de Control.) | .gif) | GetHashCode | Sert de fonction de hachage pour un type particulier. (Hérité de Object.) | .gif) | GetRouteUrl(Object) | Obtient l'URL qui correspond à un jeu de paramètres d'itinéraire. (Hérité de Control.) | .gif) | GetRouteUrl(RouteValueDictionary) | Obtient l'URL qui correspond à un jeu de paramètres d'itinéraire. (Hérité de Control.) | .gif) | GetRouteUrl(String, Object) | Obtient l'URL qui correspond à un jeu de paramètres d'itinéraire et à un nom d'itinéraire. (Hérité de Control.) | .gif) | GetRouteUrl(String, RouteValueDictionary) | Obtient l'URL qui correspond à un jeu de paramètres d'itinéraire et à un nom d'itinéraire. (Hérité de Control.) | .gif) | GetType | Obtient le Type de l'instance actuelle. (Hérité de Object.) | .gif) | GetUniqueIDRelativeTo | Retourne la partie préfixée de la propriété UniqueID du contrôle spécifié. (Hérité de Control.) | .gif) | HasControls | Détermine si le contrôle serveur contient des contrôles enfants. (Hérité de Control.) | .gif) | HasEvents | Retourne une valeur indiquant si des événements sont inscrits pour le contrôle ou des contrôles enfants. (Hérité de Control.) | .gif) | IsLiteralContent | Infrastructure. Détermine si le contrôle serveur ne détient qu'un contenu littéral. (Hérité de Control.) | .gif) | LoadControlState | Restaure des informations sur l'état du contrôle à partir d'une demande de page antérieure enregistrée par la méthode SaveControlState. (Hérité de Control.) | .gif) | LoadViewState | Charge l'état des valeurs du contrôle QueryExtender qui doivent être persistantes. (Substitue Control..::.LoadViewState(Object).) | .gif) | MapPathSecure | Récupère le chemin d'accès physique auquel un chemin d'accès virtuel, absolu ou relatif, correspond. (Hérité de Control.) | .gif) | MemberwiseClone | Crée une copie superficielle de l'objet Object actif. (Hérité de Object.) | .gif) | OnBubbleEvent | Détermine si l'événement pour le contrôle serveur est passé dans la hiérarchie des contrôles serveur de l'interface utilisateur de la page. (Hérité de Control.) | .gif) | OnDataBinding | Déclenche l'événement DataBinding. (Hérité de Control.) | .gif) | OnInit | Se produit lorsqu'une nouvelle instance de la classe QueryExtender est initialisée. (Substitue Control..::.OnInit(EventArgs).) | .gif) | OnLoad | Déclenche l'événement Load. (Hérité de Control.) | .gif) | OnPreRender | Déclenche l'événement PreRender. (Hérité de Control.) | .gif) | OnUnload | Déclenche l'événement Unload. (Hérité de Control.) | .gif) | OpenFile | Obtient un Stream utilisé pour lire un fichier. (Hérité de Control.) | .gif) | RaiseBubbleEvent | Assigne les sources éventuelles de l'événement et ses informations au parent du contrôle. (Hérité de Control.) | .gif) | RemovedControl | Appelée après la suppression d'un contrôle enfant dans la collection Controls de l'objet Control. (Hérité de Control.) | .gif) | Render | Envoie le contenu du contrôle serveur à un objet HtmlTextWriter fourni, qui écrit le contenu à rendre sur le client. (Hérité de Control.) | .gif) | RenderChildren | Renvoie le contenu des enfants d'un contrôle serveur dans un objet HtmlTextWriter fourni, qui écrit le contenu à rendre sur le client. (Hérité de Control.) | .gif) | RenderControl(HtmlTextWriter) | Renvoie le contenu du contrôle serveur dans un objet HtmlTextWriter fourni et stocke des informations de traçage au sujet du contrôle si le traçage est activé. (Hérité de Control.) | .gif) | RenderControl(HtmlTextWriter, ControlAdapter) | Génère le contenu du contrôle serveur dans un objet HtmlTextWriter à l'aide d'un objet ControlAdapter fourni. (Hérité de Control.) | .gif) | ResolveAdapter | Obtient l'adaptateur de contrôles responsable du rendu du contrôle spécifié. (Hérité de Control.) | .gif) | ResolveClientUrl | Obtient une URL qui peut être utilisée par le navigateur. (Hérité de Control.) | .gif) | ResolveUrl | Convertit une URL en une URL que le client soit en mesure d'utiliser. (Hérité de Control.) | .gif) | SaveControlState | Enregistre les modifications éventuellement apportées à l'état du contrôle serveur depuis la publication de la page sur le serveur. (Hérité de Control.) | .gif) | SaveViewState | Enregistre l'état d'affichage actuel du contrôle QueryExtender. (Substitue Control..::.SaveViewState()()().) | .gif) | SetDesignModeState | Définit les données au moment du design pour un contrôle. (Hérité de Control.) | .gif) | SetRenderMethodDelegate | Infrastructure. Assigne un délégué de gestionnaires d'événements pour générer le rendu du contrôle serveur et de son contenu dans son contrôle parent. (Hérité de Control.) | .gif) | ToString | Retourne une chaîne qui représente l'objet actuel. (Hérité de Object.) | .gif) | TrackViewState | Suit les modifications d'état d'affichage apportées au contrôle QueryExtender afin que les modifications puissent être stockées dans l'objet StateBag du contrôle. (Substitue Control..::.TrackViewState()()().) | Début

Méthodes d'extension

Implémentations d'interface explicite
|
| Nom | Description |
|---|
.gif) .gif) | IControlBuilderAccessor..::.ControlBuilder | Pour obtenir une description de ce membre, consultez IControlBuilderAccessor..::.ControlBuilder. (Hérité de Control.) | .gif) .gif) | IControlDesignerAccessor..::.GetDesignModeState | Pour obtenir une description de ce membre, consultez IControlDesignerAccessor..::.GetDesignModeState. (Hérité de Control.) | .gif) .gif) | IControlDesignerAccessor..::.SetDesignModeState | Pour obtenir une description de ce membre, consultez IControlDesignerAccessor..::.SetDesignModeState. (Hérité de Control.) | .gif) .gif) | IControlDesignerAccessor..::.SetOwnerControl | Infrastructure. Pour obtenir une description de ce membre, consultez IControlDesignerAccessor..::.SetOwnerControl. (Hérité de Control.) | .gif) .gif) | IControlDesignerAccessor..::.UserData | Pour obtenir une description de ce membre, consultez IControlDesignerAccessor..::.UserData. (Hérité de Control.) | .gif) .gif) | IDataBindingsAccessor..::.DataBindings | Pour obtenir une description de ce membre, consultez IDataBindingsAccessor..::.DataBindings. (Hérité de Control.) | .gif) .gif) | IDataBindingsAccessor..::.HasDataBindings | Pour obtenir une description de ce membre, consultez IDataBindingsAccessor..::.HasDataBindings. (Hérité de Control.) | .gif) .gif) | IExpressionsAccessor..::.Expressions | Pour obtenir une description de ce membre, consultez IExpressionsAccessor..::.Expressions. (Hérité de Control.) | .gif) .gif) | IExpressionsAccessor..::.HasExpressions | Pour obtenir une description de ce membre, consultez IExpressionsAccessor..::.HasExpressions. (Hérité de Control.) | .gif) .gif) | IParserAccessor..::.AddParsedSubObject | Pour obtenir une description de ce membre, consultez IParserAccessor..::.AddParsedSubObject. (Hérité de Control.) | Début

Notes
Dans cette rubrique : IntroductionLe contrôle QueryExtender est utilisé pour créer des filtres pour les données extraites d'une source de données, sans utiliser une clause Where explicite dans la source de données. Le contrôle QueryExtender peut être utilisé pour spécifier un filtrage à l'aide d'une syntaxe déclarative. BackgroundLe filtrage exclut des données d'une source de données en affichant uniquement les enregistrements qui répondent aux critères spécifiés. Le filtrage vous permet de présenter des vues différentes des données qui constituent un groupe de données sans affecter les données contenues dans le groupe. Le filtrage nécessite généralement la création d'une clause Where à appliquer à la commande qui interroge la source de données. Toutefois, la propriété Where du contrôle de source de données peut ne pas exposer toutes les fonctionnalités disponibles. Par exemple, le contrôle QueryExtender vous permet d'interroger une table en recherchant des chaînes au début, à la fin ou n'importe où dans le champ .data. Pour exposer les fonctionnalités complètes disponibles dans LINQ et simplifier le filtrage des données, ASP.NET fournit le contrôle QueryExtender. Le contrôle QueryExtender offre les avantages suivants : Il fournit une expérience de filtrage plus riche qu'écrire une clause Where. Par exemple, vous pouvez rechercher des valeurs booléennes dans une table Products à l'aide du filtre PropertyExpression sans écrire de requête. Il vous permet de spécifier des filtres en utilisant la même syntaxe pour les contrôles LinqDataSource et EntityDataSource, et pour tous les autres contrôles de source de données que vous pouvez utiliser. Il peut être utilisé avec le contrôle LinqDataSource, avec un contrôle EntityDataSource, ou avec des sources de données tierces.
Options de filtreLe contrôle QueryExtender prend en charge une gamme d'options que vous pouvez utiliser pour filtrer des données. Le contrôle vous permet de rechercher dans les chaînes, dans les valeurs numériques dans une plage spécifiée, et de comparer une valeur de propriété dans une table à une valeur spécifiée. Le contrôle vous laisse également trier les données et fournir des requêtes personnalisées. Ces options sont fournies comme expressions LINQ dans le contrôle QueryExtender. Le contrôle QueryExtender prend également en charge des expressions qui sont spécifiques aux applications Dynamic Data ASP.NET. Le tableau suivant répertorie les options que vous pouvez utiliser pour filtrer des données dans le contrôle QueryExtender. Vous pouvez utiliser ces options QueryExtender individuellement, ou vous pouvez les combiner pour fournir un filtrage complexe dans une page Web. Pour plus d'informations, consultez Vue d'ensemble du contrôle serveur Web QueryExtender. Procédure pas à pas : filtrage des données dans une page Web à l'aide d'une syntaxe déclarative TâchesLe tableau suivant répertorie les tâches qui indiquent comment utiliser le contrôle QueryExtender pour filtrer des données. Syntaxe déclarative
<asp:QueryExtender
EnableViewState="True|False"
ID="string"
OnDataBinding="DataBiding event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler
OnLoad="Load event handler"
OnPreRender="PreRender event handler"
OnUnload="UnLoad event hadler"
Runat="server"
TargetControlID="string"
Visible="True|False"
>
<asp:ControlFilterExpression
ControlD="string"
Column="string">
</asp:ControlFilterExpression>
<asp:DynamicFilterExpression
ControlD="string"
</asp:DynamicFilterExpression>
<asp:CustomExpression="string"
OnQuerying="OnQerying event handler">
</asp:CustomExpression>
<asp:OrderByExpression="string"
DataField="string"
Direction="string">
<asp:ThenByExpression
DataField="string"
Direction="string"
</asp:ThenBy>
</asp:OrderByExpression>
<asp:PropertyExpression="string">
<!-- child controls -->
</asp:PropertyExpression
>
<asp:RangeExpression="integer"
Datafield="string"
MaxType="Exclusive|Inclusive|None"
MinType="Exclusive|Inclusive|None">
<!--child controls-->
</asp:RangeExpression>
<asp:SearchExpression="string"
ComparisonType="CurrentCulture|CurrentCultureIgnoreCase|
InavariantCulture|InvariantCultureIgnoreCase|
Ordinal|OrdinalIgnoreCase"
DataField="string"
SearchType="Contains|EndsWith|StartsWith">
<!--child controls-->
</asp:SearchExpression>
</asp:QueryExtender>

Exemples
L'exemple suivant montre comment utiliser le contrôle QueryExtender pour fournir une fonction de recherche dans une page Web. Le contrôle QueryExtender utilise le texte entré dans le contrôle TextBoxSearch pour rechercher du contenu dans les colonnes ProductName et Supplier.CompanyName d'une table Products dans les données retournées du contrôle LinqDataSource. L'objet SearchExpression est utilisé pour exécuter la recherche. La propriété DataFields spécifie les champs de données à rechercher. La propriété SearchType spécifie le type de recherche à exécuter. L'élément ControlParameter spécifie le contrôle qui contient le texte à utiliser pour la recherche. Cet exemple de code fait partie d'un exemple plus complet fourni dans Procédure pas à pas : filtrage des données dans une page Web à l'aide d'une syntaxe déclarative.
<asp:LinqDataSource ID="dataSource" runat="server"
TableName="Products">
</asp:LinqDataSource>
<asp:QueryExtender TargetControlID="dataSource" runat="server">
<asp:SearchExpression DataFields="ProductName, Supplier.CompanyName"
SearchType="StartsWith">
<asp:ControlParameter ControlID="TextBoxSearch" />
</asp:SearchExpression>
</asp:QueryExtender>
L'exemple suivant montre comment utiliser le contrôle QueryExtender pour rechercher des valeurs dans une plage spécifiée dans une page Web. Le contrôle QueryExtender utilise les valeurs entrées dans les contrôles TextBoxFrom et TextBoxTo pour rechercher des valeurs dans les colonnes ProductName et Supplier.CompanyName d'une table Products dans les données retournées du contrôle LinqDataSource. L'élément ControlParameter spécifie les contrôles de zone de texte qui contiennent les valeurs maximale et minimale à utiliser pour la recherche de la plage. Les propriétés MinType et MaxType spécifient que les valeurs maximale et minimale doivent être incluses dans les données retournées. Cet exemple de code fait partie d'un exemple plus complet fourni dans Procédure pas à pas : filtrage des données dans une page Web à l'aide d'une syntaxe déclarative.
<asp:LinqDataSource ID="dataSource" runat="server"
TableName="Products">
</asp:LinqDataSource>
<asp:QueryExtender TargetControlID="dataSource" runat="server">
<asp:RangeExpression DataField="UnitPrice" MinType="Inclusive"
MaxType="Inclusive">
<asp:ControlParameter ControlID="TextBoxFrom" />
<asp:ControlParameter ControlID="TexBoxTo" />
</asp:RangeExpression>
</asp:QueryExtender>

Informations de version
.NET FrameworkPris en charge dans : 4

Plateformes
Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, 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.

Sécurité des threads
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.

Voir aussi
RéférenceAutres ressources
|