Go to filter Web parts Overview

Source: Internet
Author: User

Http://msdn.microsoft.com/zh-cn/library/ms494838

 

Overview of filter Web parts Office 2007

Filter Web components are very useful for Business Intelligence websites with large data volumes. Generally, Web components provide a user interface (hidden) that allows you to search or filter data (such as database tables or lists. When you connect a filter Web part to one or more Web parts on a page with the filter function, the query filtering result is displayed.

Advantages of filter Web parts

Filter Web components have many advantages for users and developers. By using filters, you can find a new and effective way to view its data. Assume that you have built an application where Web Components will contact web services, return historical records of the average daily temperatures in each U.S. state, and list the data in a table. To flexibly View data in a certain State or State, you can connect a Web part to a filter Web part, this allows you to select different states and view different results during running.

With filters, developers can reuse code and combine the functions of multiple independent web components. Assume that the developer has created a web part that saves the user address information (including the zip code) and designed it to always use this information to fill in the shipping address list when the user orders the item. Then, developers add other Web Components that depend on a specific zip code, such as web components that display weather information and important news in the user's region, and search for the Web parts of the company in the region of the given zip code by category. Developers can design each new Web part as a zip code that needs to be entered, rather than a function that has the same zip code. Then, developers only need to connect the Web parts that provide the zip code to the weather, news, and company list web parts that use the zip code as the input. Each connection extends the functionality of the original Web component and reduces unnecessary code in the new Web component.

Implement and use filter Web parts

Windows SharePoint Services 3.0 uses the ASP. NET Web parts connection framework to pass filtering conditions from one Web part to another before running a query. ASP. NET Web component connection is based on the concepts of providers and users. The provider Web parts provide information to one or more user Web parts through programming interfaces. The provider exposes some data through a clearly defined interface and the user knows how to use the data. Filter Web parts are just a special provider that provides filter values that other Web parts can use to filter data.

ASP. NET provides an integrated set of connection components. Therefore, you only need to perform a few steps and several lines of code to connect existing Web components without any potential data complexity or data synchronization. Windows SharePoint Services uses the connection framework and provides other interfaces (IfiltervaluesAndIitransformablefiltervalues), Which makes it easier to create a Web part connection for the Filtering Scheme.

Using filter Web parts, you can create dynamic programming connections between Web parts at run time, and create predefined static connections declared in Web mark. Windows SharePoint Services also provides you with a user interface (UI) that allows you to connect to or disconnect Web parts at runtime.

Web parts are connected based on the "pull" model of the connection, where the user's Web parts  from the provider's Web parts. To create a connection, a communication protocol is defined as the Web part of the data provider to indicate the data that the Web part can provide. Another Web part that serves as a user and knows the communication protocol will retrieve the data.

The connection establishment mechanism is a special callback method: each user and the provider has one. However, the Web part base class can process all the callback and communication details, so there are few steps that developers need to perform. If developers want to use the simplest method to create a filter provider, they only need to select a method in the provider as the callback method and use it in the source code.ConnectionproviderAttribute. Then make sure that no input parameters are used in this method and returnItransformablefiltervaluesInterface instance, which contains the filter data to be passed to the user. Interface instances can be very simple (for example, a single attribute that contains string values such as ZIP code ).

AvailableItransformablefiltervaluesInterface to specify the filter function, such as multiple choices, and support for all or null values. Through this interface, Windows SharePoint Services 3.0 can also use the Interface Converter internally so that different types of interfaces can communicate with each other.

The user's callback method is retrieved from the providerIfiltervaluesInterface instance. Similarly, developers only needConnectionconsumerAttribute) determines the method in the user that retrieves the interface instance and assigns it to some internal variables used for processing and rendering. Note that the data in the provider is transmitted during the page pre-presentation and Web Part loop. Therefore, after the pre-presentation is complete, you should plan to process the data and update any logic in the user.

In addition, because parameter names do not always need to be mapped to each other in the provider and user, Windows SharePoint Services providesConsumerparametersInterface. You must provide the parameter name to the provider.

Running status

When running, the Web part connection will beWebpartmanagerManagement, as described below:

  1. For each registered provider,WebpartmanagerWill call the method of the provider connection point.

  2. The provider part returns an instance of the communication interface.

  3. For every user who has registered this provider,WebpartmanagerThe user's connection point method will be called to pass an instance of this interface.

  4. Properties and methods on the user part call interface instance.

Ready-made filter Web parts

By default, Office Sharepoint Server 2007 provides the following filters in the Web Parts Library:

  • Analysis Services Filter

  • Compile a list Filter

  • Service data directory Filter

  • Current user Filter

  • Date Filter

  • Page field Filter

  • Query string (URL) Filter

  • Sharepoint list Filter

  • Text Filter

  • USERPROFILE Filter

Note:

The filter operation Web Part does not belong to the filter. It provides an "Application filter" button that you can use to apply all filters on the web page.

You can use any of these filters in custom web parts. For more information, see Walkthrough: writing a simple filter consumer Web part.

See other resources

Walkthrough: compile a simple filter user Web Part example
How to: Compile multi-choice check box filter Web parts
How to: filter Web parts using multiple check boxes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.