Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. LINQ > Using the QueryExtender Control

13.6. Using the QueryExtender Control

An alternative to specifying a where clause for an EntityDataSource control is to use the QueryExtender control. The value in the QueryExtender control is flexibility; the control supports a range of different approaches to how the data is selected, many of which are difficult or impossible to implement using the EntityDataSource where clause directly. The QueryExtender control uses declarative syntax to specify the filter, which can be frustrating until you get used to the format required, but the flexibility that arises as a consequence is worth the effort. In the following sections, we'll look at the most useful of the filtering approaches available with the QueryExtender control.

13.6.1. Using a SearchExpression

The first filter we'll look at is a SearchExpression, which finds all the instances of an entity class where a given property starts with, ends with, or contains an expression. Here is an example, which also demonstrates the declaration of the QueryExtender:


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint