<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Technical Notes</title><link>http://blogs.msdn.com/morebits/default.aspx</link><description /><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>ASP.NET Dynamic Data Overview</title><link>http://blogs.msdn.com/morebits/archive/2009/10/13/asp-net-dynamic-data-overview.aspx</link><pubDate>Tue, 13 Oct 2009 21:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9906830</guid><dc:creator>morebits</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9906830.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9906830</wfw:commentRss><description>&lt;P&gt;&lt;SPAN style="BACKGROUND-COLOR: yellow; COLOR: red; FONT-WEIGHT: bold"&gt;This post is a preview of the up-coming documentation on MSDN. &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND-COLOR: yellow; COLOR: red; FONT-WEIGHT: bold"&gt;The links in this post will point to the new topics when available.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="BACKGROUND-COLOR: yellow; COLOR: red; FONT-WEIGHT: bold"&gt;Please, send us your feedback.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;ASP.NET Dynamic Data lets you create extensible data-driven Web applications by inferring at runtime the appearance and behavior of data entities from the database schema and deriving UI behavior from it. &lt;/P&gt;
&lt;P&gt;Dynamic Data supports scaffolding, which is a way to automatically generate Web pages for each table in the database. Scaffolding lets you create a functional Web site for viewing and editing data based on the schema of the data. You can easily customize scaffolding elements or create new ones to override the default behavior. &lt;/P&gt;
&lt;P&gt;You can also enable dynamic behavior in existing or new Web applications without using scaffolding. In that case, you specify how and when Dynamic Data should infer UI elements from the data source without using scaffolding for the entire Web site.&lt;/P&gt;
&lt;H3&gt;Dynamic Data Architecture &lt;/H3&gt;
&lt;P&gt;Dynamic Data obtains data schema information or metadata from a data model that represents database entities as common language runtime (CLR) types.&lt;/P&gt;
&lt;P&gt;The following illustration shows the Dynamic Data architecture. The dashed-line boxes represent technologies that are defined in the CLR but that are used by Dynamic Data.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/ASP.NETDynamicDataOverview_B8B9/ddarchitecture_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/ASP.NETDynamicDataOverview_B8B9/ddarchitecture_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" border=0 alt="Dynamic Data Architecture" src="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/ASP.NETDynamicDataOverview_B8B9/ddarchitecture_thumb.jpg" width=590 height=588 useMap=#ddarcmap mce_src="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/ASP.NETDynamicDataOverview_B8B9/ddarchitecture_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;MAP name=ddarcmap&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/ee225351(VS.100).aspx" shape=rect alt="Using Dynamic Data in ASP.NET Applications" target=_blank coords=219,0,332,30 mce_href="http://msdn.microsoft.com/en-us/library/ee225351(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx" shape=rect alt="Page Templates" target=_blank coords=12,81,87,119 mce_href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx" shape=rect alt="Entity Templates" target=_blank coords=308,80,396,119 mce_href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx" shape=rect alt="Field Templates" target=_blank coords=15,149,104,189 mce_href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx" shape=rect alt="Filter Templates" target=_blank coords=261,147,353,190 mce_href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/cc488557(VS.100).aspx" shape=rect alt="Custom Field Templates" target=_blank coords=123,149,238,189 mce_href="http://msdn.microsoft.com/en-us/library/cc488557(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/cc488537(VS.100).aspx" shape=rect alt="Custom Page Templates" target=_blank coords=99,81,192,120 mce_href="http://msdn.microsoft.com/en-us/library/cc488537(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/ee211433(VS.100).aspx" shape=rect alt="Presentation Layer" target=_blank coords=535,48,577,182 mce_href="http://msdn.microsoft.com/en-us/library/ee211433(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/ee225428(VS.100).aspx" shape=rect alt="Data Layer" target=_blank coords=531,231,579,331 mce_href="http://msdn.microsoft.com/en-us/library/ee225428(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/ee225428(VS.100).aspx" shape=rect alt="DL Customization" target=_blank coords=17,227,166,266 mce_href="http://msdn.microsoft.com/en-us/library/ee225428(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/bb386976(VS.100).aspx" shape=rect alt="LINQ to SQL" target=_blank coords=13,397,128,433 mce_href="http://msdn.microsoft.com/en-us/library/bb386976(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/bb399572(VS.100).aspx" shape=rect alt="Entity Framework" target=_blank coords=188,397,335,434 mce_href="http://msdn.microsoft.com/en-us/library/bb399572(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;AREA href="http://msdn.microsoft.com/en-us/library/ee529972(VS.100).aspx" shape=rect alt="ASP.NET Dynamic Data Overview" target=_blank coords=166,500,342,534 mce_href="http://msdn.microsoft.com/en-us/library/ee529972(VS.100).aspx"&gt;&lt;/AREA&gt;&lt;/MAP&gt;&lt;/P&gt;
&lt;P&gt;As the illustration shows, Dynamic Data architecture contains the following layers:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;Presentation layer, which contains templates such as page, entity, field, and filter templates that are used to create the UI for displaying and editing data entities. &lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Data layer, which contains the data model that represents the database entities as CLR types.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Data source mapping layer, which contains elements that are part of the CLR but are used by Dynamic Data. These elements are technologies such as &lt;A href="http://msdn.microsoft.com/en-us/library/bb386976(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb386976(VS.100).aspx"&gt;LINQ to SQL&lt;/A&gt; and &lt;A href="http://msdn.microsoft.com/en-us/library/bb399572(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb399572(VS.100).aspx"&gt;ADO.NET Entity Framework&lt;/A&gt; that are used to generate data models. &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;These layers together provide the scaffolding that lets Dynamic Data generate Web pages for each table in the database. &lt;/P&gt;
&lt;H5&gt;Presentation Layer Elements&lt;/H5&gt;
&lt;P&gt;This section provides a quick overview of the Dynamic Data elements that are used to create the UI for displaying and editing data entities. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx"&gt;ASP.NET Dynamic Data Scaffolding&lt;/A&gt;. &lt;/P&gt;
&lt;H6&gt;Page Templates&lt;/H6&gt;
&lt;P&gt;Page templates are Web pages that render data from any table in the database. Dynamic Data includes page templates for different views of data, such as listing a table (List view), displaying master/detail tables (Details view), and editing data (Edit view). By default, Dynamic Data uses only a List view page template. When you create a Dynamic Data Web project, Visual Studio adds a DynamicData\PageTemplates folder to the project. This folder contains the default page templates. You can modify the default page templates or create new ones in order to specify how tables are rendered.&lt;/P&gt;
&lt;H6&gt;Entity Templates&lt;/H6&gt;
&lt;P&gt;Entity templates are user controls that let you customize the layout for a whole table (that is, for a data row). Entity templates give you better control over table layout than page templates. &lt;/P&gt;
&lt;P&gt;When you create a Dynamic Data Web project, Visual Studio adds a DynamicData\EntityTemplates folder to the project. This folder contains the default entity templates. There are templates for display, edit, and insert operations. The default entity templates show data in two columns, using a label for the field name and an appropriate control for the field value.&amp;nbsp; You can modify default entity templates to change the appearance and behavior of data rows for the whole site.&lt;/P&gt;
&lt;P&gt;Entity templates are included in the Details.aspx, Insert.aspx and Update.aspx page templates and any custom pages. Entity templates in turn use field templates to render the actual data. &lt;/P&gt;
&lt;P&gt;For more information about how to use entity templates, see the related topics listed in the &lt;A href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts&amp;amp;sectionid=11743&amp;amp;postid=9906830#Scenarios" mce_href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts&amp;amp;sectionid=11743&amp;amp;postid=9906830#Scenarios"&gt;Dynamic Data Scenarios&lt;/A&gt; section. &lt;/P&gt;
&lt;H6&gt;Field Templates&lt;/H6&gt;
&lt;P&gt;Field templates are user controls that render the UI for individual data fields. By default, Dynamic Data selects a field template for a field based on the data type of the field. For example, to display Boolean data, Dynamic Data uses the Boolean field template; to display text data, Dynamic Data uses a text field template; and so on. There is typically one field template to display data, and a different template that lets users enter or edit field values. &lt;/P&gt;
&lt;P&gt;Dynamic Data selects the appropriate field template to use based on the data field type. When you create a Dynamic Data Web project, Visual Studio adds a DynamicData\FieldTemplates folder to the project. This folder contains the default field templates. You can modify the default field templates or create new ones in order to specify how individual data fields are rendered.&lt;/P&gt;
&lt;H6&gt;Filter Templates&lt;/H6&gt;
&lt;P&gt;Filter templates are user controls that render the UI for data filtering, which lets the user choose the table rows to display based on a selected column value. Dynamic Data enables you to use page markup to create the UI for data filtering for a column you identify. If a filter template does not exist for that column type, you can create a custom one and instruct Dynamic Data to use it when it creates the UI. You can also create page markup to let Dynamic Data automatically generate the UI for any column type for which a default filter template exists. By default, Dynamic Data provides Boolean, foreign-key, and enumeration filter templates.&lt;/P&gt;
&lt;P&gt;When you create a Dynamic Data Web project, Visual Studio adds a DynamicData\FilterTemplates folder to the project. This folder contains the default filter templates. &lt;/P&gt;
&lt;H5&gt;Data Layer Elements&lt;/H5&gt;
&lt;P&gt;ASP.NET Dynamic supports &lt;A href="http://msdn.microsoft.com/en-us/library/bb386976(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb386976(VS.100).aspx"&gt;LINQ to SQL&lt;/A&gt; and &lt;A href="http://msdn.microsoft.com/en-us/library/bb399572(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb399572(VS.100).aspx"&gt;ADO.NET Entity Framework&lt;/A&gt; data models. Dynamic Data uses these types to query the database and to perform create, read, update, and delete (CRUD) operations. The data models also provide an easy way to integrate custom data validation and business logic rules. &lt;/P&gt;
&lt;P&gt;When you create a new project in Visual Studio 2010, you can select the LINQ to SQL Classes or the ADO.NET Entity Data Model template. This selection determines the type of model that is used by the project. Dynamic Data scaffolding can support only one of the data model type in the same project.&lt;/P&gt;
&lt;P&gt;At run time, Dynamic Data automatically extracts metadata information from the data model, such as data field properties. From this information, it infers how to create UI for displaying and editing data. To render the UI, it uses the following information:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;Information about associations between tables is used to display foreign-key columns and navigate between tables.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Data-type information is used to add validation for a data field. For example, null column information can be used to determine whether a data field is required. Length information can be used to restrict the maximum length of user's text input.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://i.msdn.microsoft.com/Global/Images/clear.gif" mce_src="http://i.msdn.microsoft.com/Global/Images/clear.gif"&gt;&lt;/P&gt;
&lt;H3&gt;&lt;A title=UsingDD name=UsingDD&gt;&lt;/A&gt;Using Dynamic Data &lt;/H3&gt;
&lt;P&gt;&lt;A&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Dynamic Data scaffolding supports the following design options:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;Create a Web site using scaffolding. You can create a basic Web application that uses ASP.NET Dynamic Data with minimal coding. When scaffolding is enabled, ASP.NET analyzes the data model and generates Web pages dynamically based on the metadata information. These auto-generated Web pages provide CRUD capabilities for each table. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/cc488469(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488469(VS.100).aspx"&gt;Walkthrough: Creating a New Dynamic Data Web Site Using Scaffolding&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Add dynamic behavior to individual data-bound controls (such as the GridView and ListView controls) in an existing ASP.NET Web site. You can enable Dynamic Data in ASP.NET data-bound controls without using scaffolding and a data model. This enables you to use Dynamic Data features such as run-time datafield validation, in-memory page templates which do not require scaffolding, and &lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations(VS.100).aspx"&gt;System.ComponentModel.DataAnnotations&lt;/A&gt; attributes to customize data fields. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/cc488549(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488549(VS.100).aspx"&gt;Walkthrough: Using Dynamic Data in ASP.NET Data-Bound Controls&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Add Dynamic Data features to an existing or new ASP.NET Web site. You can create a Web site and include Dynamic Data features without using scaffolding. You can also customize the Dynamic Data Web site capabilities. A defining aspect of ASP.NET Dynamic Data is that it can infer at runtime the appearance and behavior of data fields from the database schema. This information is then used in the data-bound controls, with the support of templates, to eliminate the need for repetitive code in the presentation layer. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/cc668188(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc668188(VS.100).aspx"&gt;Walkthrough: Create a Web Site that Uses Dynamic Data&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;For more information about Dynamic Data scenarios, see &lt;A href="http://msdn.microsoft.com/en-us/library/cc488545(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488545(VS.100).aspx"&gt;Using ASP.NET Dynamic Data Content Map&lt;/A&gt;.&lt;/P&gt;
&lt;H5&gt;Customizing Dynamic Data&lt;/H5&gt;
&lt;P&gt;An important Dynamic Data feature is customization. Customization options can be grouped into the following categories:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;Customizing general behavior. You can modify how Dynamic Data performs tasks that do not rely on a specific database schema. You make these modifications in the presentation layer and then use them for any number of projects. This type of customization lets you define consistent behavior for any data schema, without redefining the behavior every time that you add or modify a data entity. The customization is performed by modifying the default templates or by creating custom templates to display and interact with the database. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/ee211433(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/ee211433(VS.100).aspx"&gt;ASP.NET Dynamic Data Presentation Layer Customization&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Customizing schema-specific behavior. You can customize Dynamic Data behavior for individual tables or fields based on the data model or database schema. In this case, the customization is specific to the instance of the data model. For example, you can customize the UI for an individual data field; you can create a custom page template or use entity templates to render an individual table. You can apply custom metadata to specific data fields to modify their appearance and behavior by using the &lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations(VS.100).aspx"&gt;System.ComponentModel.DataAnnotations&lt;/A&gt; attributes. You can also customize the behavior of an application, which lets you create custom validation and bind tables or fields in the data model to specific templates. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/ee225428(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/ee225428(VS.100).aspx"&gt;ASP.NET Dynamic Data Model Customization&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;A Visual Studio project with source code is available at this location: &lt;A href="http://go.microsoft.com/fwlink/?LinkId=155841" mce_href="http://go.microsoft.com/fwlink/?LinkId=155841"&gt;Download LINQ to SQL version&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A title=Scenarios name=Scenarios&gt;&lt;/A&gt;Dynamic Data Scenarios &lt;/P&gt;
&lt;P&gt;&lt;A&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The following is a selection of Dynamic Data scenarios with topics that describe them and related examples.&lt;/P&gt;
&lt;TABLE border=1 cellSpacing=0 cellPadding=2 width=836&gt;
&lt;TBODY&gt;
&lt;TR style="BACKGROUND-COLOR: lightgray; FONT-WEIGHT: bold"&gt;
&lt;TD vAlign=top width=287&gt;Scenario&lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;Topic &lt;/TD&gt;
&lt;TD vAlign=top width=220&gt;Description and Examples&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=289&gt;Enabling dynamic behavior in data-bound controls in an existing Web site &lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc488549(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488549(VS.100).aspx"&gt;Walkthrough: Using Dynamic Data in ASP.NET Data-Bound Controls&lt;/A&gt; &lt;/TD&gt;
&lt;TD vAlign=top width=219&gt;This approach is useful if you have an existing Web site and you want to use validation and templates with minimal coding. 
&lt;P&gt;A Visual Studio project with source code is available for this scenario: &lt;A href="http://go.microsoft.com/fwlink/?LinkId=162154" mce_href="http://go.microsoft.com/fwlink/?LinkId=162154"&gt;Download LINQ to SQL version&lt;/A&gt;.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=289&gt;Customizing appearance and behavior of an individual table &lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc488532(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488532(VS.100).aspx"&gt;How to: Customize Data Field Appearance and Behavior in a Dynamic Data Control&lt;/A&gt; &lt;/TD&gt;
&lt;TD vAlign=top width=219&gt;This approach lets you customize an individual table. It is a schema specific customization that is performed by creating a custom Web page to render the table. &lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=289&gt;Customizing appearance and behavior of an individual data field. &lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc488557(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488557(VS.100).aspx"&gt;How to: Customize Data Field Appearance and Behavior in the Data Model&lt;/A&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=287&gt;This approach is used to customize an individual data field. It is a schema-specific in which you create a custom field template. 
&lt;P&gt;See a run-time code example of this feature: &lt;A href="http://go.microsoft.com/fwlink/?LinkId=120736&amp;amp;sref=DynamicData.CustomAppearanceBehavior&amp;amp;spage=CustomAppearanceBehavior.aspx" mce_href="http://go.microsoft.com/fwlink/?LinkId=120736&amp;amp;sref=DynamicData.CustomAppearanceBehavior&amp;amp;spage=CustomAppearanceBehavior.aspx"&gt;Run&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;See a video that shows this feature: &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=DF5AEBB5-3252-4595-9326-5335DDE48504" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=DF5AEBB5-3252-4595-9326-5335DDE48504"&gt;Watch&lt;/A&gt;.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=289&gt;Customizing appearance and behavior associated with a data field type&lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc488533(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488533(VS.100).aspx"&gt;How to: Customize ASP.NET Dynamic Data Default Field Templates&lt;/A&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=287&gt;
&lt;P&gt;This approach is used to customize a data field type in the whole application. It is a general behavior customization in the presentation layer in which you customize the default field templates. &lt;/P&gt;
&lt;P&gt;See a video that shows this feature: &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=A49B1992-7E19-4D7C-A7D0-8C2FC86866A7" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=A49B1992-7E19-4D7C-A7D0-8C2FC86866A7"&gt;Watch&lt;/A&gt;. &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=289&gt;Customizing appearance and behavior of an individual data field by using a field template that is more specific than the default field template&lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc668199(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc668199(VS.100).aspx"&gt;How to: Customize Data Field Appearance and Behavior For Non-Intrinsic Data Types in the Data Model&lt;/A&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=287&gt;
&lt;P&gt;This approach is used to &lt;A&gt;customize an individual data field&lt;/A&gt; . It is a schema specific customization. It is obtained by applying a field template that is more specific than the default template for the field data type. For example, you can mark a text field that contains e-mail addresses as an e-mail type.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=289&gt;Customizing the appearance and behavior of an individual table by using a custom page template&lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc488537(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488537(VS.100).aspx"&gt;How to: Customize the Layout of an Individual Table By Using a Custom Page Template&lt;/A&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=287&gt;This approach is used to customize an individual table. It is a schema specific customization that enables you to use Dynamic Data templates and tailor them to your specific needs&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=289&gt;Customizing the appearance and behavior of an individual table by using custom entity templates&lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd723645(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd723645(VS.100).aspx"&gt;Walkthrough: Customizing Table layout using Entity Templates&lt;/A&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=287&gt;
&lt;P&gt;This approach is used to customize an individual table. It is a general behavior customization in which you create custom entity templates. It is an alternative to the custom page template approach and gives you a better control over the table layout.&lt;/P&gt;
&lt;P&gt;A Visual Studio project with source code is available at this location: &lt;A href="http://go.microsoft.com/fwlink/?linkid=151901" mce_href="http://go.microsoft.com/fwlink/?linkid=151901"&gt;Download&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=289&gt;Customizing data field validation by using a custom validation attribute&lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc668224(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc668224(VS.100).aspx"&gt;How to: Customize Data Field Validation in the Data Model Using Custom Attributes&lt;/A&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=287&gt;
&lt;P&gt;This approach is used to customize the validation of an individual data field. It is a schema specific customization in which you apply a custom validation attribute to the data field in the data model. You use this approach when the available data-validation attributes do not satisfy your requirements.&lt;/P&gt;
&lt;P&gt;See a run-time code example of this feature: &lt;A href="http://go.microsoft.com/fwlink/?LinkId=120736&amp;amp;sref=DynamicData.CustomAttributeValidation&amp;amp;spage=CustomAttributeValidation.aspx" mce_href="http://go.microsoft.com/fwlink/?LinkId=120736&amp;amp;sref=DynamicData.CustomAttributeValidation&amp;amp;spage=CustomAttributeValidation.aspx"&gt;Run&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=289&gt;Customizing data field validation by using attributes, or by customizing method that process field changes, or by customizing the validation event handler&lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc488527(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488527(VS.100).aspx"&gt;How to: Customize Data Field Validation in the Data Model&lt;/A&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=287&gt;
&lt;TABLE cellSpacing=0 cellPadding=0&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD vAlign=top&gt;
&lt;P&gt;This approach is used to customize the validation of an individual data field. It is a schema specific customization that is obtained for example by overriding the OnValidate event handler.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;Run an online example of this feature: &lt;A href="http://go.microsoft.com/fwlink/?LinkId=120736&amp;amp;sref=DynamicData.CustomValidation&amp;amp;spage=CustomValidation.aspx" mce_href="http://go.microsoft.com/fwlink/?LinkId=120736&amp;amp;sref=DynamicData.CustomValidation&amp;amp;spage=CustomValidation.aspx"&gt;Run&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=289&gt;Filtering table rows to display in a child table by using a foreign-key value from a parent table&lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd985039(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd985039(VS.100).aspx"&gt;Walkthrough: Filtering Rows in Tables with a Parent-Child Relationship&lt;/A&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=287&gt;
&lt;P&gt;This approach is used to filter the table rows to display based on a foreign-key value from a parent table.&lt;/P&gt;
&lt;P&gt;A Visual Studio project with source code is available at this location: &lt;A href="http://go.microsoft.com/fwlink/?LinkId=155841" mce_href="http://go.microsoft.com/fwlink/?LinkId=155841"&gt;Download LINQ to SQL version&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc488549(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488549(VS.100).aspx"&gt;Walkthrough: Using Dynamic Data in ASP.NET Data-Bound Controls&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This approach is useful if you have an existing Web site and you want to use validation and templates with minimal coding. &lt;/P&gt;
&lt;P&gt;A Visual Studio project with source code is available for this scenario: &lt;A href="http://go.microsoft.com/fwlink/?LinkId=162154" mce_href="http://go.microsoft.com/fwlink/?LinkId=162154"&gt;Download LINQ to SQL version&lt;/A&gt;.&lt;/P&gt;
&lt;H3&gt;&lt;A title=Reference name=Reference&gt;&lt;/A&gt;Namespace Reference 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;A&gt;&lt;/A&gt;&lt;/H3&gt;
&lt;P&gt;The following table lists the namespaces that contain the ASP.NET Dynamic Data classes.&lt;/P&gt;
&lt;TABLE border=1 cellSpacing=0 cellPadding=2 width=774&gt;
&lt;TBODY&gt;
&lt;TR style="BACKGROUND-COLOR: lightgray; FONT-WEIGHT: bold"&gt;
&lt;TD vAlign=top width=392&gt;Namespace&lt;/TD&gt;
&lt;TD vAlign=top width=380&gt;Description&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=423&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations(VS.100).aspx"&gt;System.ComponentModel.DataAnnotations&lt;/A&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=395&gt;Provides attribute classes that are used to define metadata for Dynamic Data objects. The classes are used to customize dynamic data behavior. &lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=431&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata(VS.100).aspx"&gt;System.Web.DynamicData&lt;/A&gt; &lt;/TD&gt;
&lt;TD vAlign=top width=399&gt;Contains classes that provide the core functionality for ASP.NET Dynamic Data. These classes provide extensibility features to customize dynamic data behavior. &lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=434&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.design(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.design(VS.100).aspx"&gt;System.Web.DynamicData.Design &lt;/A&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=398&gt;Contains classes that provide design-time support for the classes in the &lt;A href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata(VS.100).aspx"&gt;System.Web.DynamicData&lt;/A&gt; namespace. &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;H3&gt;&lt;A title=Info name=Info&gt;&lt;/A&gt;Additional Information 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;A&gt;&lt;/A&gt;&lt;/H3&gt;
&lt;P&gt;Suggestions for additional exploration include the following:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;Understanding URL routing. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/cc668201(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc668201(VS.100).aspx"&gt;ASP.NET Routing&lt;/A&gt;. &lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Understanding LINQ-to-SQL Object-Relational mapping. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/bb386976(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb386976(VS.100).aspx"&gt;LINQ to SQL&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Understanding the ADO.NET Entity Framework. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/bb399572(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb399572(VS.100).aspx"&gt;ADO.NET Entity Framework&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/#Introduction" mce_href="http://msdn.microsoft.com/#Introduction"&gt;Back to top&lt;/A&gt;&lt;/P&gt;
&lt;H3&gt;See Also&lt;/H3&gt;
&lt;P&gt;&lt;A&gt;&lt;/A&gt;&lt;/P&gt;
&lt;H6&gt;Tasks&lt;/H6&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc488469(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488469(VS.100).aspx"&gt;Walkthrough: Creating a New Dynamic Data Web Site Using Scaffolding&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc668188(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc668188(VS.100).aspx"&gt;Walkthrough: Create a Web Site that Uses Dynamic Data&lt;/A&gt;&lt;/P&gt;
&lt;H6&gt;Concepts&lt;/H6&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ee225351(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/ee225351(VS.100).aspx"&gt;Using Dynamic Data in ASP.NET Applications&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ee225308(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/ee225308(VS.100).aspx"&gt;Customizing ASP.NET Dynamic Data&lt;/A&gt;&lt;/P&gt;
&lt;H6&gt;Other Resources&lt;/H6&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/ee377606(VS.100).aspx"&gt;ASP.NET Dynamic Data Scaffolding&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9906830" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/morebits/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category></item><item><title>Using Simple Bing Search over SOAP Protocol in an ASP.NET Web Application</title><link>http://blogs.msdn.com/morebits/archive/2009/09/03/using-bing-search-service-over-soap-protocol-in-an-asp-net-web-application.aspx</link><pubDate>Thu, 03 Sep 2009 02:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9890626</guid><dc:creator>morebits</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9890626.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9890626</wfw:commentRss><description>&lt;H4&gt;Introduction&lt;/H4&gt;
&lt;P&gt;This walkthrough shows how to use a simple Bing search as a Web service in an ASP.NET Web application. The Bing search features are invoked by the ASP.NET Web application using SOAP protocol over HTTP. &lt;/P&gt;
&lt;P&gt;You can also use XML and JSON to invoke the service. We'll have related examples at a later time.&lt;/P&gt;
&lt;P&gt;This walkthrough shows you how to perform the following tasks:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Create a client Web application to interact with BING service. &lt;/LI&gt;
&lt;LI&gt;Add the reference to the Bing search service. &lt;/LI&gt;
&lt;LI&gt;Perform live search by using Bing SourceTypes. &lt;/LI&gt;&lt;/UL&gt;
&lt;H5&gt;&lt;STRONG&gt;Bing Service Background&lt;/STRONG&gt;&lt;/H5&gt;
&lt;P&gt;Complex problems such as indexing, relevance logic, and hosting issues such as CPU and storage are solved in transparent way to your application by having the ability to use the BING features as a Web service. This article offers a starting point for adding the service to your application.&lt;/P&gt;
&lt;P&gt;Remember that a Web service is a component on a Web server that a client application can call by making HTTP requests across the Web. If you want some good explanation about this subject, see this MSDN article &lt;A href="http://msdn.microsoft.com/en-us/library/t745kdsh.aspx" mce_href="http://msdn.microsoft.com/en-us/library/t745kdsh.aspx"&gt;Using ASP.NET Web Services&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;By using the Bing search service you can integrate the following features in your application:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Retrieve information from the Internet. &lt;/LI&gt;
&lt;LI&gt;Add advertisements to your application. &lt;/LI&gt;
&lt;LI&gt;Improve and enhance search requests and results. &lt;/LI&gt;
&lt;LI&gt;Find location-specific information. &lt;/LI&gt;
&lt;LI&gt;Translate terms and blocks of text. &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;You interact with the Bing Service through the &lt;A href="file://api/" mce_href="http://msdn.microsoft.com/en-us/library/dd251056.aspx"&gt;Bing API&lt;/A&gt;.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Each of the previous feature is associated with one or more Bing API &lt;B&gt;&lt;I&gt;SourceTypes&lt;/I&gt;&lt;/B&gt;. A SourceType is a source of information accessible using the &lt;A href="http://msdn.microsoft.com/en-us/library/dd251056.aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd251056.aspx"&gt;Bing API&lt;/A&gt;.&amp;nbsp;&amp;nbsp; An overall description of these SourceTypes can be find on MSDN at this location: &lt;A href="http://msdn.microsoft.com/en-us/library/dd251072.aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd251072.aspx"&gt;About the Bing API&lt;/A&gt;.&lt;/P&gt;
&lt;H5&gt;Prerequisites&lt;/H5&gt;
&lt;P&gt;In order to complete the example in this topic, you need the following:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Visual Studio 2008. &lt;/LI&gt;
&lt;LI&gt;The ability to send requests using the Simple Object Access Protocol (SOAP) 1.1 and the Hyper Text Transfer Protocol (HTTP 1.1) &lt;/LI&gt;
&lt;LI&gt;The ability to parse SOAP and XML &lt;/LI&gt;&lt;/UL&gt;
&lt;H4&gt;Creating a Web Application&lt;/H4&gt;
&lt;P&gt;This section shows how to create a Web application that will use the Bing search service.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;To create an ASP.NET Web application&lt;/B&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Start Visual Studio 2008. &lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;File&lt;/STRONG&gt; menu, click &lt;STRONG&gt;New&lt;/STRONG&gt;, and then click &lt;STRONG&gt;Project&lt;/STRONG&gt;. &lt;/LI&gt;
&lt;LI&gt;The &lt;STRONG&gt;New Project&lt;/STRONG&gt; dialog box is displayed. &lt;/LI&gt;
&lt;LI&gt;In the left pane, under &lt;STRONG&gt;Project types&lt;/STRONG&gt;, expand the &lt;STRONG&gt;Visual C#&lt;/STRONG&gt; node then select &lt;STRONG&gt;Web&lt;/STRONG&gt;.&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;Visual Studio installed templates&lt;/STRONG&gt; right pane, select &lt;STRONG&gt;ASP.NET Web Application&lt;/STRONG&gt;. &lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;Location&lt;/STRONG&gt; box enter the name of the folder where you want to keep the Web application. For example, enter the folder name &lt;B&gt;C:\WebApplications\CS\. &lt;/B&gt;&lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;Name&lt;/STRONG&gt; dialog box enter the name of the project. For example, enter the name &lt;STRONG&gt;SoapBasicSearch&lt;/STRONG&gt;. &lt;/LI&gt;
&lt;LI&gt;Click &lt;STRONG&gt;OK&lt;/STRONG&gt;. &lt;/LI&gt;
&lt;LI&gt;An ASP.NET application is created. &lt;/LI&gt;&lt;/OL&gt;
&lt;H4&gt;Referencing Bing Search Service &lt;/H4&gt;
&lt;P&gt;This section shows how to reference the Bing search service. In order to do that, you use a Web service discovery process by which your application locates the service and obtains its description. The process of Web service discovery in Visual Studio involves interrogating a Web site to locate the service description, which is an XML document that uses the Web Services Description Language (WSDL). &lt;/P&gt;
&lt;P&gt;When you add a Web reference to a project, Visual Studio generates a proxy class that provides a local representation of the Web service. The proxy enables your application to interface with the Web service. You can access Web service methods by calling the methods in the proxy class. The proxy class handles the communication between your application and the Web service itself. &lt;/P&gt;
&lt;P&gt;&lt;B&gt;To reference the Bing Search Service&lt;/B&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;In &lt;B&gt;Solution Explorer&lt;/B&gt;, right-click the project name then click &lt;B&gt;Add Web Reference &lt;/B&gt;button. &lt;/LI&gt;
&lt;LI&gt;In the &lt;B&gt;Add Web Reference &lt;/B&gt;panel, in the &lt;STRONG&gt;URL&lt;/STRONG&gt;&lt;B&gt; &lt;/B&gt;box enter the following value: &lt;A href="http://api.search.live.net/search.wsdl" mce_href="http://api.search.live.net/search.wsdl"&gt;http://api.search.live.net/search.wsdl&lt;/A&gt;. &lt;/LI&gt;
&lt;LI&gt;Click &lt;STRONG&gt;GO &lt;/STRONG&gt;(represented by a green arrow). &lt;/LI&gt;
&lt;LI&gt;If the process has been successfully a message is displayed saying that "1 Service Found: Search" and the Web reference is: &lt;STRONG&gt;net.live.search.api&lt;/STRONG&gt;. &lt;/LI&gt;
&lt;LI&gt;Click the &lt;B&gt;Add Reference &lt;/B&gt;button. &lt;/LI&gt;
&lt;LI&gt;A Web References folder is added to the project that contains the reference to the Bing search service API. &lt;/LI&gt;
&lt;LI&gt;Also, the Web.config file is updated to contains address information about the soap.asmx service. The following is an example of the configuration update. &lt;/LI&gt;&lt;/OL&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;applicationSettings&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
       &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;UsingBingService.Properties.Settings&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
           &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;setting &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;name&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="UsingBingService_net_live_search_api_LiveSearchService"
               &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;serializeAs&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="String"&amp;gt;
               &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;http://api.search.live.net:80/soap.asmx&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
           &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;setting&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
       &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;UsingBingService.Properties.Settings&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
   &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;applicationSettings&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;H4&gt;Performing Search by Using Bing Service Types&lt;/H4&gt;
&lt;P&gt;This section shows the code that enables the user to choose the desired Bing ServiceType to perform live search. For simplicity only the types listed in the table shown next are used. Also, the search are “hard-coded” and code used comes from the &lt;A href="http://msdn.microsoft.com/en-us/library/dd251066.aspx" target=_blank&gt;Code Samples (Bing, Version 2.0)&lt;/A&gt; on MSDN: .&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;TABLE border=1 cellSpacing=0 cellPadding=0 width=530&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=201&gt;
&lt;P&gt;&lt;B&gt;SourceType&lt;/B&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;
&lt;P&gt;&lt;B&gt;Function&lt;/B&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=201&gt;
&lt;P&gt;Web&lt;/P&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=327&gt;
&lt;P&gt;Retrieve information from the Internet&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;H5&gt;&amp;nbsp;&lt;/H5&gt;
&lt;H5&gt;Selecting the ServiceType to Use&lt;/H5&gt;
&lt;OL&gt;
&lt;LI&gt;In &lt;B&gt;Solution Explorer &lt;/B&gt;, open the default.aspx page. Then add the following markup. &lt;/LI&gt;&lt;/OL&gt;
&lt;BLOCKQUOTE&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;h2&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;Using BING Service&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;h2&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
  &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;ul&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;li&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;href&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="WebSourceType.aspx" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;target&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="_blank"&amp;gt;&lt;/SPAN&gt;Using the Web SourceType over the SOAP Protocol&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;li&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt; 
  &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;ul&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
 &lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;H5&gt;Create the Code to Interact with the Web ServiceType&lt;/H5&gt;
&lt;OL&gt;
&lt;LI&gt;In &lt;B&gt;Solution Explorer &lt;/B&gt;, right-click the project name then click &lt;STRONG&gt;Add&lt;/STRONG&gt; and select &lt;STRONG&gt;New Item&lt;/STRONG&gt;. &lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;Installed Templates&lt;/STRONG&gt; dialog, select &lt;STRONG&gt;Web Form&lt;/STRONG&gt;. &lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;Name&lt;/STRONG&gt; box enter WebSourceType.aspx. &lt;/LI&gt;
&lt;LI&gt;Click the &lt;STRONG&gt;Add&lt;/STRONG&gt; button. &lt;/LI&gt;
&lt;LI&gt;In the newly created WebSourceType.aspx page enter the following markup and save the file. &lt;/LI&gt;&lt;/OL&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;form &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="form1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
        
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;h2&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;Using the Web SourceType Over the SOAP Protocol&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;h2&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
            
            &lt;/SPAN&gt;This example shows how to perform the following tasks:
            
            &lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;ul&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
                &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;li&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;Set search request basic parameters by using the 
                    &lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;href&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="http://msdn.microsoft.com/en-us/library/dd250960.aspx" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;target&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="_blank"&amp;gt;&lt;/SPAN&gt;SearchRequest&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;type.&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;li&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
                &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;li&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;Set the Web book request by using the 
                    &lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;href&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="http://msdn.microsoft.com/en-us/library/dd250886.aspx" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;target&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="_blank"&amp;gt;&lt;/SPAN&gt;WebRequest&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;type. &lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;li&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
                &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;li&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;Display the results obtained  from the 
                    &lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;href&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="http://msdn.microsoft.com/en-us/library/dd250843.aspx" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;target&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="_blank"&amp;gt;&lt;/SPAN&gt;SearchResponse&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;type. &lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;li&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;ul&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
          
            &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;h4&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;See Also &lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;h4&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
            &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;span &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;style&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;background-color&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:Yellow"&amp;gt;
                &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;href&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="http://msdn.microsoft.com/en-us/library/dd251056.aspx" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;target&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="_blank"&amp;gt;&lt;/SPAN&gt;BING API&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;span&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
            &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;br &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;/&amp;gt; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;br &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;

            &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;span &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;style&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;background-color&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:Yellow"&amp;gt;&lt;/SPAN&gt;For more information, see 
                &lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;href&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="http://blogs.msdn.com/morebits/" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;target&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="_blank"&amp;gt;&lt;/SPAN&gt;Technical Notes&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;span&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
            &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;br &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;/&amp;gt; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;br &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;
            
            &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;Table &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="WebResultID" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;BorderWidth&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="1"    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;  
                &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;TableHeaderRow &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;BackColor&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LightGray"&amp;gt;
                    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;TableCell &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="hdrID1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;BorderStyle&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Inset"/&amp;gt;
                &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;TableHeaderRow&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;Table&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
            
        
    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;form&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;OL&gt;
&lt;LI&gt;In &lt;B&gt;Solution Explorer &lt;/B&gt;, open the code behind file WebSourceType.aspx.cs and add the following code and save the file. &lt;/LI&gt;&lt;/OL&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: green"&gt;      // Get the search results. Display one result per row.
      &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;private void &lt;/SPAN&gt;DisplayResults(SearchResponse response)
      {
          &lt;SPAN style="COLOR: blue"&gt;int &lt;/SPAN&gt;j &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;0; 
          &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(WebResult result &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;response&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Results)
          {
             
              TableRow tRow &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;TableRow();
             
              WebResultID&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Rows&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Add(tRow);
              TableCell tCell &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;TableCell();
              tCell&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;BorderWidth &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;Unit&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Parse(&lt;SPAN style="COLOR: #a31515"&gt;"1"&lt;/SPAN&gt;);
              &lt;SPAN style="COLOR: blue"&gt;if &lt;/SPAN&gt;(j &lt;SPAN style="COLOR: teal"&gt;% &lt;/SPAN&gt;2 &lt;SPAN style="COLOR: teal"&gt;== &lt;/SPAN&gt;0)
                  tCell&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;BackColor &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Drawing&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Color&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Blue;
              &lt;SPAN style="COLOR: blue"&gt;else
                  &lt;/SPAN&gt;tCell&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;BackColor &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Drawing&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Color&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Tomato;

              tCell&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;ForeColor &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Drawing&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Color&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Yellow;
              tCell&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Font&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Bold &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;

              System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Text&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;StringBuilder builder &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Text&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;StringBuilder();
          
              builder&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;AppendLine(result&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Title);
              builder&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;AppendLine(result&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Description);
              builder&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;AppendLine(result&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Url);
              builder&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Append(&lt;SPAN style="COLOR: #a31515"&gt;"Last Crawled: "&lt;/SPAN&gt;);
              builder&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;AppendLine(result&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;DateTime);
              j&lt;SPAN style="COLOR: teal"&gt;++&lt;/SPAN&gt;;

              &lt;SPAN style="COLOR: blue"&gt;int &lt;/SPAN&gt;i &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;0;
              &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;char &lt;/SPAN&gt;c &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;builder&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;ToString()&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;ToCharArray())
              {

                  &lt;SPAN style="COLOR: blue"&gt;if &lt;/SPAN&gt;(c &lt;SPAN style="COLOR: teal"&gt;== &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;'\uE000'&lt;/SPAN&gt;)
                  {
                      &lt;SPAN style="COLOR: green"&gt;// If the current character is the begin highlighting
                      // character (U+E000), change it to a left square bracket.

                      &lt;/SPAN&gt;builder[i] &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;Convert&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;ToChar(&lt;SPAN style="COLOR: #a31515"&gt;"["&lt;/SPAN&gt;);


                  }

                  &lt;SPAN style="COLOR: blue"&gt;else if &lt;/SPAN&gt;(c &lt;SPAN style="COLOR: teal"&gt;== &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;'\uE001'&lt;/SPAN&gt;)
                  {
                      &lt;SPAN style="COLOR: green"&gt;// If the current character is the end highlighting
                      // character (U+E001), change it to a right square bracket.
                      &lt;/SPAN&gt;builder[i] &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;Convert&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;ToChar(&lt;SPAN style="COLOR: #a31515"&gt;"]"&lt;/SPAN&gt;);
                  }

                  i&lt;SPAN style="COLOR: teal"&gt;++&lt;/SPAN&gt;;
              }

              tCell&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Text &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;builder&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;ToString();

              tRow&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Cells&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Add(tCell);

          }

         
      }

      &lt;SPAN style="COLOR: blue"&gt;protected override void &lt;/SPAN&gt;OnPreRender(EventArgs e)
      {
          &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;OnPreRender(e);
          SearchResponse response &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;UsingWebSourceType&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;PerformLiveSearch();
       
          &lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;results &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Format(&lt;SPAN style="COLOR: #a31515"&gt;"Displaying {0} to {1} of {2} results"&lt;/SPAN&gt;, response&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Offset &lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;1,
                         response&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Offset &lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;response&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Results&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Length, response&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Total);

          &lt;SPAN style="COLOR: green"&gt;// Add header information to the table.
          &lt;/SPAN&gt;hdrID1&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Text &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"&amp;lt;div style='color:red; font-weight:bold'&amp;gt;' &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"Bing API Version: " &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;response&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Version &lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"&amp;lt;/div&amp;gt;" &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;+
                          &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"&amp;lt;div style='color:red; font-weight:bold'&amp;gt;' &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"Phonebook results for " &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;response&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Query&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;SearchTerms &lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"&amp;lt;/div&amp;gt;" &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;+
                          &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"&amp;lt;div style='color:red; font-weight:bold''&amp;gt;' &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;results &lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"&amp;lt;/div&amp;gt;"&lt;/SPAN&gt;;
          &lt;SPAN style="COLOR: green"&gt;// Add rows to the table that contain search results.
          &lt;/SPAN&gt;DisplayResults(response);

         
      }&lt;/PRE&gt;&lt;PRE class=code&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;OL&gt;
&lt;LI&gt;In &lt;B&gt;Solution Explorer &lt;/B&gt;, right-click the project name then click &lt;STRONG&gt;Add&lt;/STRONG&gt; and select &lt;STRONG&gt;New Item&lt;/STRONG&gt;. &lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;Installed Templates&lt;/STRONG&gt; dialog, select &lt;STRONG&gt;Code File&lt;/STRONG&gt;. &lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;Name&lt;/STRONG&gt; box enter ApiId.cs. &lt;/LI&gt;
&lt;LI&gt;Click the &lt;STRONG&gt;Add&lt;/STRONG&gt; button. &lt;/LI&gt;
&lt;LI&gt;In the newly created file enter the following code and save the file. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The following static class enables you to have a single place where to define the AppID.&lt;/P&gt;
&lt;P&gt;Remember you need this ID to use the Bing Search Service. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/dd251020.aspx" target=_blank&gt;Getting Started with Bing API, Version 2&lt;/A&gt;.&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;System;
&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Collections&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Generic;
&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Linq;
&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web;
&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Xml;

&lt;SPAN style="COLOR: green"&gt;// This using directive assumes that the project's default namespace is
// "SoapBasicSearch" and the name of the Bing API web reference is
// "net.live.search.api". Modify this using directive as necessary.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;SoapBasicSearch&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;net&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;live&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;search&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;api;

&lt;SPAN style="COLOR: blue"&gt;namespace &lt;/SPAN&gt;SoapBasicSearch
{
    &lt;SPAN style="COLOR: blue"&gt;public static class &lt;/SPAN&gt;AppID
    {
        &lt;SPAN style="COLOR: green"&gt;// Replace the following string with the AppId you received from the
        // Bing Developer Center.
        &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public const string &lt;/SPAN&gt;Current &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"Enter your AppId"&lt;/SPAN&gt;;
    }
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;OL&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;LI&gt;In &lt;B&gt;Solution Explorer &lt;/B&gt;, right-click the project name then click &lt;STRONG&gt;Add&lt;/STRONG&gt; and select &lt;STRONG&gt;New Item&lt;/STRONG&gt;. &lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;Installed Templates&lt;/STRONG&gt; dialog, select &lt;STRONG&gt;Code File&lt;/STRONG&gt;. &lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;Name&lt;/STRONG&gt; box enter UsingWebSourceType.cs. &lt;/LI&gt;
&lt;LI&gt;Click the &lt;STRONG&gt;Add&lt;/STRONG&gt; button. &lt;/LI&gt;
&lt;LI&gt;In the newly created file enter the following code and save the file. &lt;/LI&gt;&lt;/OL&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;System;
&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Collections&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Generic;
&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Linq;
&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web;
&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Xml;

&lt;SPAN style="COLOR: green"&gt;// This using directive assumes that the project's default namespace is
// "SoapBasicSearch" and the name of the Bing API web reference is
// "net.live.search.api". Modify this using directive as necessary.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;SoapBasicSearch&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;net&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;live&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;search&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;api;

&lt;SPAN style="COLOR: blue"&gt;namespace &lt;/SPAN&gt;SoapBasicSearch
{
    &lt;SPAN style="COLOR: blue"&gt;public static class &lt;/SPAN&gt;UsingWebSourceType
    {
        
        &lt;SPAN style="COLOR: blue"&gt;public static &lt;/SPAN&gt;SearchResponse PerformLiveSearch()
        {
            &lt;SPAN style="COLOR: green"&gt;// LiveSearchService implements IDisposable.
            &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;(LiveSearchService service &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;LiveSearchService())
            {
                SearchResponse response &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;SearchResponse();

                &lt;SPAN style="COLOR: blue"&gt;try
                &lt;/SPAN&gt;{
                    SearchRequest request &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;BuildRequest();

                    &lt;SPAN style="COLOR: green"&gt;// Send the request; display the response.
                    &lt;/SPAN&gt;response &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;service&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Search(request);

                }
                &lt;SPAN style="COLOR: blue"&gt;catch &lt;/SPAN&gt;(System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Services&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Protocols&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;SoapException ex)
                {
                    &lt;SPAN style="COLOR: green"&gt;// A SOAP Exception was thrown. Display error details.
                    &lt;/SPAN&gt;DisplayErrors(ex&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Detail);
                }
                &lt;SPAN style="COLOR: blue"&gt;catch &lt;/SPAN&gt;(System&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Net&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;WebException ex)
                {
                    &lt;SPAN style="COLOR: green"&gt;// An exception occurred while accessing the network.
                    &lt;/SPAN&gt;HttpContext&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Current&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Response&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Write(ex&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Message);
                }

                &lt;SPAN style="COLOR: blue"&gt;return &lt;/SPAN&gt;response;
            }
        }

        &lt;SPAN style="COLOR: blue"&gt;static &lt;/SPAN&gt;SearchRequest BuildRequest()
        {
            SearchRequest request &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;SearchRequest();

            &lt;SPAN style="COLOR: green"&gt;// Common request fields (required)
            &lt;/SPAN&gt;request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;AppId &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;AppID&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Current;
            request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Query &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"msdn blogs"&lt;/SPAN&gt;;
            request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Sources &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;SourceType[] { SourceType&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web };

            &lt;SPAN style="COLOR: green"&gt;// Common request fields (optional)
            &lt;/SPAN&gt;request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Version &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"2.0"&lt;/SPAN&gt;;
            request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Market &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;"en-us"&lt;/SPAN&gt;;
            request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Adult &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;AdultOption&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Moderate;
            request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;AdultSpecified &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;
            request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Options &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;SearchOption[]
        {
            SearchOption&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;EnableHighlighting
        };

            &lt;SPAN style="COLOR: green"&gt;// Web-specific request fields (optional)
            &lt;/SPAN&gt;request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;WebRequest();
            request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Count &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;10;
            request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;CountSpecified &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;
            request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Offset &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;0;
            request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;OffsetSpecified &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;
            request&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Web&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Options &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;WebSearchOption[]
        {
            WebSearchOption&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;DisableHostCollapsing,
            WebSearchOption&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;DisableQueryAlterations
        };

            &lt;SPAN style="COLOR: blue"&gt;return &lt;/SPAN&gt;request;
        }


        &lt;SPAN style="COLOR: blue"&gt;static void &lt;/SPAN&gt;DisplayErrors(XmlNode errorDetails)
        {
            &lt;SPAN style="COLOR: green"&gt;// Add the default namespace to the namespace manager.
            &lt;/SPAN&gt;XmlNamespaceManager nsmgr &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XmlNamespaceManager(
                errorDetails&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;OwnerDocument&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;NameTable);
            nsmgr&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;AddNamespace(
                &lt;SPAN style="COLOR: #a31515"&gt;"api"&lt;/SPAN&gt;,
                &lt;SPAN style="COLOR: #a31515"&gt;"http://schemas.microsoft.com/LiveSearch/2008/03/Search"&lt;/SPAN&gt;);

            XmlNodeList errors &lt;SPAN style="COLOR: teal"&gt;= &lt;/SPAN&gt;errorDetails&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;SelectNodes(
                &lt;SPAN style="COLOR: #a31515"&gt;"./api:Errors/api:Error"&lt;/SPAN&gt;,
                nsmgr);

            &lt;SPAN style="COLOR: blue"&gt;if &lt;/SPAN&gt;(errors &lt;SPAN style="COLOR: teal"&gt;!= &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)
            {
                &lt;SPAN style="COLOR: green"&gt;// Iterate over the list of errors and display error details.
                &lt;/SPAN&gt;HttpContext&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Current&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Response&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Write(&lt;SPAN style="COLOR: #a31515"&gt;"Errors"&lt;/SPAN&gt;);
                &lt;SPAN style="COLOR: green"&gt;//Console.WriteLine("Errors:");
                //Console.WriteLine();
                &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(XmlNode error &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;errors)
                {
                    &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(XmlNode detail &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;error&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;ChildNodes)
                    {
                        HttpContext&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Current&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Response&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Write(detail&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;Name &lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;": " &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;+ &lt;/SPAN&gt;detail&lt;SPAN style="COLOR: teal"&gt;.&lt;/SPAN&gt;InnerText);
                        &lt;SPAN style="COLOR: green"&gt;// Console.WriteLine(detail.Name + ": " + detail.InnerText);
                    &lt;/SPAN&gt;}

                }
            }
        }
    }
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;H4&gt;Testing Bing Search Service in the Web Application &lt;/H4&gt;
&lt;P&gt;This section shows the steps to perform to test the application.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Build the Web application. &lt;/LI&gt;
&lt;LI&gt;In &lt;STRONG&gt;Solution Explorer&lt;/STRONG&gt; right click on default.aspx. &lt;/LI&gt;
&lt;LI&gt;Click the &lt;EM&gt;Using the Web SourceType over the SOAP Protocol&lt;/EM&gt; link &lt;/LI&gt;
&lt;LI&gt;The Web ServiceType search results are displayed. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;We are done. &lt;/P&gt;
&lt;P&gt;A &lt;B&gt;complete Visual Studio project &lt;/B&gt;is attached next. Please &lt;B&gt;download and play&lt;/B&gt; with it.&lt;/P&gt;
&lt;P&gt;I appreciate your feedback.&lt;/P&gt;
&lt;H5&gt;See Also&lt;/H5&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd251056.aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd251056.aspx"&gt;Bing API, Version 2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd251062.aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd251062.aspx"&gt;Working with Protocols (Bing, Version 2)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd251066.aspx" target=_blank&gt;Code Samples (Bing, Version 2.0)&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9890626" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/morebits/attachment/9890626.ashx" length="169869" type="application/x-zip-compressed" /></item><item><title>Walkthrough: Filtering Rows in Tables with a Parent-Child Relationship</title><link>http://blogs.msdn.com/morebits/archive/2009/09/01/walkthrough-filtering-rows-in-tables-with-a-parent-child-relationship.aspx</link><pubDate>Tue, 01 Sep 2009 02:22:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9889610</guid><dc:creator>morebits</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9889610.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9889610</wfw:commentRss><description>&lt;p&gt;[Note:&amp;#160; This document is a preliminary version of a walkthrough that will be released with the Beta 2 version of Visual Studio 2010 and ASP.NET 4.]&lt;/p&gt;  &lt;h4&gt;Introduction&lt;/h4&gt;  &lt;p&gt;This walkthrough shows how to filter rows in tables with a parent-child relationship. &lt;/p&gt;  &lt;p&gt;Filtering table rows refers to the ability provided to the user to choose (filter) the table rows to display based on a selected column value, it also defines whether data fields are displayed or in what order they are displayed.&lt;/p&gt;  &lt;p&gt;This walkthrough illustrates the following tasks:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Set the parent table for selecting a foreign-key. The setting includes a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.LinqDataSource&lt;/a&gt; control to access the database that contains the parent table. It also includes a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.GridView&lt;/a&gt; control to display the parent table and enable the selection of the foreign-key value.&lt;/li&gt;    &lt;li&gt;Set the child table for displaying filtered rows. The setting includes a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.LinqDataSource&lt;/a&gt; control to access the database that contains the child table. It also includes a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.GridView&lt;/a&gt; control to display the child table filtered rows.&lt;/li&gt;    &lt;li&gt;Set child table rows filtering. The &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.queryextender(VS.100).aspx" target="_blank"&gt;T:System.Web.UI.WebControls.QueryExtender&lt;/a&gt; control is set in such a way to enable child table rows filtering based on the foreign-key selected by the user in the parent table.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The example shown in this topic uses tables from the AdventureWorks database. More specifically, it uses the child Product table that contains the foreign-key column ProductCategory defined in the parent table ProductCategories. The relationship between tables is one-to-many that is a single category can contain many products. The following figure shows the relationship between the tables:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/WalkthroughFilteringRowsinTableswithaPar_DF5C/filtering_2.gif"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="filtering" border="0" alt="filtering" src="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/WalkthroughFilteringRowsinTableswithaPar_DF5C/filtering_thumb.gif" width="387" height="292" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;By default, Dynamic Data includes templates that let you perform filtering for Boolean, foreign-key, and enumeration column values. In these templates, filtering is defined declaratively by using the ASP.NET &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.queryextender(VS.100).aspx" target="_blank"&gt;T:System.Web.UI.WebControls.QueryExtender&lt;/a&gt; control .&lt;/p&gt;  &lt;p&gt;A Visual Studio project with source code is available at this location: &lt;a href="http://go.microsoft.com/fwlink/?LinkId=155841"&gt;Download LINQ to SQL version&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The following figure shows the steps that Dynamic Data performs to filter rows in tables that have a parent-child relationship. &lt;/p&gt;  &lt;p&gt;The figure illustrates the following sequence:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/WalkthroughFilteringRowsinTableswithaPar_DF5C/ParentChildContext_2.gif"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ParentChildContext" border="0" alt="ParentChildContext" src="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/WalkthroughFilteringRowsinTableswithaPar_DF5C/ParentChildContext_thumb.gif" width="508" height="368" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;1. The parent data-bound control passes the user's selected foreign-key to the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.queryextender(VS.100).aspx" target="_blank"&gt;T:System.Web.UI.WebControls.QueryExtender&lt;/a&gt; control.&lt;/p&gt;  &lt;p&gt;2. The &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.queryextender(VS.100).aspx" target="_blank"&gt;T:System.Web.UI.WebControls.QueryExtender&lt;/a&gt; control uses this foreign-key value to create the query filtering information. It then passes this filtering information to the data source control that fetches child rows. &lt;/p&gt;  &lt;p&gt;3. The child data source control passes the filtering query information to the data source provider. &lt;/p&gt;  &lt;p&gt;4. The data source provider passes the query to the database.&lt;/p&gt;  &lt;p&gt;5. The database returns the filtered table rows.&lt;/p&gt;  &lt;p&gt;6. The data source provider sends this data back to the child data source control. &lt;/p&gt;  &lt;p&gt;7. This control finally passes the filtered table rows to the child data-bound control for display.&lt;/p&gt;  &lt;h4&gt;Prerequisites&lt;/h4&gt;  &lt;p&gt;This walkthrough assumes that you have created a Dynamic Data Web site and that you are using a data context that is based on LINQ to SQL. For more information, see &lt;a href="http://msdn.microsoft.com/en-us/library/cc488469.aspx" target="_blank"&gt;Walkthrough: Creating a New Dynamic Data Web Site using Scaffolding&lt;/a&gt;.&lt;/p&gt;  &lt;h4&gt;Setting the Parent Table for Selecting a Foreign-Key&lt;/h4&gt;  &lt;p&gt;In this section you will set the parent table for selecting a foreign-key. The setting includes a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.LinqDataSource&lt;/a&gt; control to access the database that contains the parent table. It also includes a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.GridView&lt;/a&gt; control to display the parent table and enable the selection of the foreign-key value.    &lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="590"&gt;           &lt;p&gt;&lt;b&gt;&lt;font size="2"&gt;To set the parent table for selecting a foreign key&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="590"&gt;           &lt;p&gt;8. In &lt;strong&gt;Solution Explorer&lt;/strong&gt;, right-click the project name, and then click &lt;strong&gt;Add New Item&lt;/strong&gt;. &lt;/p&gt;            &lt;p&gt;9. Under &lt;strong&gt;Installed Templates&lt;/strong&gt; in the right pane, select &lt;strong&gt;Web Form&lt;/strong&gt;.&lt;/p&gt;            &lt;p&gt;In the &lt;strong&gt;Name&lt;/strong&gt; box, enter ParentChild.aspx. &lt;/p&gt;            &lt;p&gt;10. Switch to Design modality by clicking on the &lt;strong&gt;Design&lt;/strong&gt; tab. &lt;/p&gt;            &lt;p&gt;11. From the Data tab of the Toolbox, add a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.dynamicdatamanager.aspx" target="_blank"&gt;T:System.Web.DynamicData.DynamicDataManager&lt;/a&gt; control to the page.&lt;/p&gt;            &lt;p&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.dynamicdatamanager.aspx" target="_blank"&gt;T:System.Web.DynamicData.DynamicDataManager&lt;/a&gt; control must be included on a page in order to support Dynamic Data for data-bound controls. The markup for the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.dynamicdatamanager.aspx" target="_blank"&gt;T:System.Web.DynamicData.DynamicDataManager&lt;/a&gt; control must precede the markup for any controls that use Dynamic Data. We will register the necessary data-bound controls to be managed in later steps.&lt;/p&gt;            &lt;p&gt;12. From the &lt;strong&gt;Data&lt;/strong&gt; tab of the &lt;strong&gt;Toolbox&lt;/strong&gt;, add a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.LinqDataSource&lt;/a&gt; control to the page.&lt;/p&gt;            &lt;p&gt;13. From the &lt;strong&gt;LinqDataSource Tasks&lt;/strong&gt; menu click on the &lt;strong&gt;Configure Data Source&lt;/strong&gt;.&lt;/p&gt;            &lt;p&gt;14. The &lt;strong&gt;Choose a Context Object&lt;/strong&gt; dialog box is displayed. &lt;/p&gt;            &lt;p&gt;15. Choose the context object AdventureWorksLTDataContext. &lt;/p&gt;            &lt;p&gt;16. Click the &lt;strong&gt;Next&lt;/strong&gt; button.&lt;/p&gt;            &lt;p&gt;17. The &lt;strong&gt;Configure Data Selection&lt;/strong&gt; dialog box is displayed.&lt;/p&gt;            &lt;p&gt;18. In the &lt;strong&gt;Table&lt;/strong&gt; drop-down list control, select the parent table ProductCategories.&lt;/p&gt;            &lt;p&gt;19. In the &lt;strong&gt;Select&lt;/strong&gt; box leave the box with the asterisk checked. This will select all the rows of the ProductCategories table.&lt;/p&gt;            &lt;p&gt;20. Click the &lt;strong&gt;Finish&lt;/strong&gt; button.&lt;/p&gt;            &lt;p&gt;21. From the &lt;strong&gt;Data&lt;/strong&gt; group of the &lt;strong&gt;Toolbox&lt;/strong&gt;, add a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.GridView&lt;/a&gt; control to the page. This control is used to display the ProductCategories table data fields. &lt;/p&gt;            &lt;p&gt;22. From the &lt;strong&gt;GridView Tasks&lt;/strong&gt; menu in the &lt;strong&gt;Choose Data Source&lt;/strong&gt; drop-down list control, select LinqDataSource1. This is the ID of the data source control created in the previous steps.&lt;/p&gt;            &lt;p&gt;23. Enable paging and selection by checking the related check-boxes. &lt;/p&gt;            &lt;p&gt;24. Switch to source modality, by clicking the &lt;strong&gt;Source&lt;/strong&gt; tab.&lt;/p&gt;            &lt;p&gt;25. For display clarity above the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.GridView&lt;/a&gt; control enter the following markup:&lt;/p&gt;            &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;h2&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;Parent Table: ProductCategories&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;h2&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
          &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

          &lt;p&gt;26. In the &amp;lt;Coulmns&amp;gt; tag, delete all the &amp;lt;asp:BoundField&amp;gt; controls.&lt;/p&gt;

          &lt;p&gt;27. Enable automatic columns generation, set page size, and set the selection index to a category that is not empty. The following example shows how to set these properties.&lt;/p&gt;

          &lt;pre class="code"&gt;   &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridView &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GridView1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; 
     &lt;/span&gt;&lt;span style="color: red"&gt;DataSourceID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LinqDataSource1&amp;quot; 
     &lt;/span&gt;&lt;span style="color: red"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot;
     &lt;/span&gt;&lt;span style="color: red"&gt;PageSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;SelectIndex&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;4&amp;quot;&amp;gt; 
   &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridView&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

          &lt;p&gt;28. Switch to Design modality by clicking on the &lt;strong&gt;Design&lt;/strong&gt; tab.&lt;/p&gt;

          &lt;p&gt;29. From the &lt;strong&gt;DynamicDataManager Tasks&lt;/strong&gt; menu, click &lt;strong&gt;Register Controls&lt;/strong&gt;.&lt;/p&gt;

          &lt;p&gt;30. The &lt;strong&gt;DataControlReference Collection Editor&lt;/strong&gt; is displayed.&lt;/p&gt;

          &lt;p&gt;31. In the &lt;strong&gt;Members&lt;/strong&gt; pane, click the &lt;strong&gt;Add&lt;/strong&gt; button. A DataControl entry is displayed in the &lt;strong&gt;Members&lt;/strong&gt; box.&lt;/p&gt;

          &lt;p&gt;32. In the &lt;strong&gt;DataControl properties&lt;/strong&gt; pane in the &lt;strong&gt;ControlID&lt;/strong&gt; drop-down list control box select GridView1.&lt;/p&gt;

          &lt;p&gt;33. Click OK.&lt;/p&gt;

          &lt;p&gt;34. Right-click on the page and select View in Browser. The ProductCategories table rows are displayed.&lt;/p&gt;

          &lt;p&gt;35. Save the ParentChid.aspx file. &lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;h4&gt;Setting the Child Table for Displaying Filtered Rows&lt;/h4&gt;

&lt;p&gt;In this section you will set the child table for displaying filtered rows. The setting includes a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.LinqDataSource&lt;/a&gt; control to access the database that contains the child table. It also includes a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.GridView&lt;/a&gt; control to display the child table filtered rows.

  &lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" width="590"&gt;
          &lt;p&gt;&lt;b&gt;To set the child table for displaying filtered rows&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="590"&gt;
          &lt;p&gt;&lt;a name="a"&gt;&lt;/a&gt;36. While in the ParentChild.aspx file, switch to Design modality by clicking on the &lt;strong&gt;Design&lt;/strong&gt; tab. &lt;/p&gt;

          &lt;p&gt;37. From the &lt;strong&gt;Data&lt;/strong&gt; tab of the &lt;strong&gt;Toolbox&lt;/strong&gt;, add a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.LinqDataSource&lt;/a&gt; control to the page.&lt;/p&gt;

          &lt;p&gt;38. From the &lt;strong&gt;LinqDataSource Tasks&lt;/strong&gt; menu click on the &lt;strong&gt;Configure Data Source&lt;/strong&gt;.&lt;/p&gt;

          &lt;p&gt;39. The &lt;strong&gt;Choose a Context Object&lt;/strong&gt; dialog box is displayed. &lt;/p&gt;

          &lt;p&gt;40. In the &lt;strong&gt;Choose your context obje&lt;/strong&gt;ct drop-down list control box, choose the context object AdventureWorksLTDataContext. &lt;/p&gt;

          &lt;p&gt;41. Click the &lt;strong&gt;Next&lt;/strong&gt; button.&lt;/p&gt;

          &lt;p&gt;42. The &lt;strong&gt;Configure Data Selection&lt;/strong&gt; dialog box is displayed.&lt;/p&gt;

          &lt;p&gt;43. In the &lt;strong&gt;Table&lt;/strong&gt; drop-down list control box, select the child table Products.&lt;/p&gt;

          &lt;p&gt;44. In the &lt;strong&gt;Select&lt;/strong&gt; box leave the box with the asterisk checked. This will select all the rows of the Products table.&lt;/p&gt;

          &lt;p&gt;45. Click the &lt;strong&gt;Finish&lt;/strong&gt; button.&lt;/p&gt;

          &lt;p&gt;46. From the Data group of the Toolbox, add a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.GridView&lt;/a&gt; control to the page. This control is used to display the Products table data fields. &lt;/p&gt;

          &lt;p&gt;48. From the &lt;strong&gt;GridView Tasks&lt;/strong&gt; menu in the &lt;strong&gt;Choose Data Source&lt;/strong&gt; drop-down list control, select LinqDataSource2. This is the ID of the data source control created in the previous steps.&lt;/p&gt;

          &lt;p&gt;49. Enable paging and selection by checking the related check-boxes. &lt;/p&gt;

          &lt;p&gt;50. Switch to source modality, by clicking the &lt;strong&gt;Source&lt;/strong&gt; tab.&lt;/p&gt;

          &lt;p&gt;51. For display clarity above the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx" target="_blank"&gt;T:System.Web.UI.WebControls.GridView&lt;/a&gt; control enter the following markup:&lt;/p&gt;

          &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;h2&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;Child Table: Products&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;h2&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;p&gt;52. In the &amp;lt;Coulmns&amp;gt; tag, delete all the &amp;lt;asp:BoundField&amp;gt; controls.&lt;/p&gt;

          &lt;p&gt;53. Enable automatic columns generation and set page size. The following example shows how to set these properties.&lt;/p&gt;

          &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;       &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridView &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GridView2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; 
         &lt;/span&gt;&lt;span style="color: red"&gt;DataSourceID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LinqDataSource2&amp;quot; 
         &lt;/span&gt;&lt;span style="color: red"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;PageSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot;&amp;gt; 
       &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridView&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
          &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

          &lt;p&gt;54. Switch to Design modality by clicking on the &lt;strong&gt;Design&lt;/strong&gt; tab.&lt;/p&gt;

          &lt;p&gt;55. From the &lt;strong&gt;DynamicDataManager Tasks&lt;/strong&gt; menu, click &lt;strong&gt;Register Controls&lt;/strong&gt;. &lt;/p&gt;

          &lt;p&gt;56. The &lt;strong&gt;DataControlReference Collection Editor&lt;/strong&gt; is displayed.&lt;/p&gt;

          &lt;p&gt;57. In the &lt;strong&gt;Members&lt;/strong&gt; pane, click the &lt;strong&gt;Add&lt;/strong&gt; button. A DataControl entry is displayed in the &lt;strong&gt;Members&lt;/strong&gt; box.&lt;/p&gt;

          &lt;p&gt;58. In the &lt;strong&gt;DataControl properties&lt;/strong&gt; pane in the &lt;strong&gt;ControlID&lt;/strong&gt; drop-down list control box select GridView2.&lt;/p&gt;

          &lt;p&gt;59. Click OK.&lt;/p&gt;

          &lt;p&gt;60. Right-click on the page and select View in Browser. The Products table rows are displayed.&lt;/p&gt;

          &lt;p&gt;61. Save the ParentChid.aspx file.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;h4&gt;Set the Child Table Row Filtering&lt;/h4&gt;

&lt;p&gt;In this final section you will set the child table rows filtering. The &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.queryextender(VS.100).aspx" target="_blank"&gt;T:System.Web.UI.WebControls.QueryExtender&lt;/a&gt; control is set in such way to enable child table rows filtering based on the foreign-key selected by the user in the parent table.

  &lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" width="590"&gt;
          &lt;p&gt;&lt;b&gt;To set the child table row filtering&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="590"&gt;
          &lt;p&gt;62. In the ParentChild.aspx page, add a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.queryextender(VS.100).aspx" target="_blank"&gt;T:System.Web.UI.WebControls.QueryExtender&lt;/a&gt; control and set its P:System.Web.UI.WebControls.QueryExtender.TargetControlID property to the ID of the data source control that is associated with the child table whose rows you want to filter.&lt;/p&gt;

          &lt;p&gt;The following example shows the markup for a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.queryextender(VS.100).aspx" target="_blank"&gt;T:System.Web.UI.WebControls.QueryExtender&lt;/a&gt; control that specifies the data source control LinqDataSource2 is associated with the child table.&lt;/p&gt;

          &lt;pre class="code"&gt;      &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;QueryExtender &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;QueryExtenderID&amp;quot; 
         &lt;/span&gt;&lt;span style="color: red"&gt;TargetControlID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LinqDataSource2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &amp;gt;
       &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;QueryExtender&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
          &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

          &lt;p&gt;63. Add a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.controlfilterexpression(VS.100).aspx" target="_blank"&gt;T:System.Web.DynamicData.ControlFilterExpression&lt;/a&gt; object as a child of the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.queryextender(VS.100).aspx" target="_blank"&gt;T:System.Web.UI.WebControls.QueryExtender&lt;/a&gt; control. The following example shows the markup for adding a &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.controlfilterexpression(VS.100).aspx" target="_blank"&gt;T:System.Web.DynamicData.ControlFilterExpression&lt;/a&gt; object to the control. &lt;/p&gt;

          &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;     &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;QueryExtender &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;QueryExtenderID&amp;quot; 
       &lt;/span&gt;&lt;span style="color: red"&gt;TargetControlID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LinqDataSource2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &amp;gt;
       &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;ControlFilterExpression &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
     &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;QueryExtender&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
          &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

          &lt;p&gt;64. Set the ControlID property of the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.controlfilterexpression(VS.100).aspx" target="_blank"&gt;T:System.Web.DynamicData.ControlFilterExpression&lt;/a&gt; object to the data-bound control associated with the parent table. &lt;/p&gt;

          &lt;p&gt;65. Set the Column property of the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.controlfilterexpression(VS.100).aspx" target="_blank"&gt;T:System.Web.DynamicData.ControlFilterExpression&lt;/a&gt; object to the column in the parent table that is used for filtering. This column represents a foreign key in the child table.&lt;/p&gt;

          &lt;p&gt;The following example shows the markup for a &lt;/p&gt;

          &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.controlfilterexpression(VS.100).aspx" target="_blank"&gt;T:System.Web.DynamicData.ControlFilterExpression&lt;/a&gt; object that points to a data-bound control and a foreign-key associated with the parent table. &lt;/p&gt;

          &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;       &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;QueryExtender &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;QueryExtenderID&amp;quot; 
         &lt;/span&gt;&lt;span style="color: red"&gt;TargetControlID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LinqDataSource2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &amp;gt;
         &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;ControlFilterExpression &lt;/span&gt;&lt;span style="color: red"&gt;ControlID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GridView1&amp;quot;
           &lt;/span&gt;&lt;span style="color: red"&gt;Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ProductCategory&amp;quot; /&amp;gt;
       &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;QueryExtender&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
          &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

          &lt;p&gt;66. Save the file. &lt;/p&gt;

          &lt;p&gt;67. In Solution Explorer, right-click the ParentChild.aspx page and then select View in Browser. &lt;/p&gt;

          &lt;p&gt;68. In the ProductCategories parent table select a category. &lt;/p&gt;

          &lt;p&gt;Dynamic Data filters the Products table rows based on the category that you selected.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;h4&gt;See Also&lt;/h4&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc488469.aspx" target="_blank"&gt;Walkthrough: Creating a New Dynamic Data Web Site using Scaffolding&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9889610" width="1" height="1"&gt;</description></item><item><title>Walkthrough: Using BING Service over SOAP Protocol in a Console Application</title><link>http://blogs.msdn.com/morebits/archive/2009/08/27/walkthrough-using-bing-service-over-soap-protocol-in-a-console-application.aspx</link><pubDate>Fri, 28 Aug 2009 01:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9887595</guid><dc:creator>morebits</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9887595.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9887595</wfw:commentRss><description>&lt;h3&gt;Introduction&lt;/h3&gt; &lt;p&gt;This walkthrough shows how to use the BING features as a Web service in a client console application. This service, that we'll call BING Service, is invoked by the client console application using SOAP protocol over HTTP. You can also use XML and JSON to invoke the service. We'll have related examples at a later time.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;BING Service Background&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Complex problems such as indexing, relevance logic, and hosting issues such as CPU and storage are solved in transparent way to your application by having the ability to use the BING features as a Web service. This article offers a starting point for adding the service to your application.&lt;/p&gt; &lt;p&gt;Remember that a Web service is a component on a Web server that a client application can call by making HTTP requests across the Web. If you want some good explanation about this subject, see this MSDN article &lt;a href="http://msdn.microsoft.com/en-us/library/t745kdsh.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/t745kdsh.aspx"&gt;&lt;font color="#669966"&gt;Using ASP.NET Web Services&lt;/font&gt;&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;By using the service you can integrate the following features in your application:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Retrieve information from the Internet.  &lt;li&gt;Add advertisements to your application.  &lt;li&gt;Improve and enhance search requests and results.  &lt;li&gt;Find location-specific information.  &lt;li&gt;Translate terms and blocks of text. &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;You interact with the BING Service through the &lt;a href="http://msdn.microsoft.com/en-us/library/dd251056.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd251056.aspx"&gt;&lt;font color="#669966"&gt;BING API&lt;/font&gt;&lt;/a&gt;.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Each of the previous feature is associated with one or more Bing API &lt;b&gt;&lt;i&gt;SourceTypes&lt;/i&gt;&lt;/b&gt;. A SourceType is a source of information accessible via the &lt;a href="http://msdn.microsoft.com/en-us/library/dd251056.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd251056.aspx"&gt;&lt;font color="#669966"&gt;BING API&lt;/font&gt;&lt;/a&gt;.&amp;nbsp;&amp;nbsp; An overall description of these SourceTypes can be find on MSDN at this location: &lt;a href="http://msdn.microsoft.com/en-us/library/dd251072.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd251072.aspx"&gt;&lt;font color="#669966"&gt;About the Bing API&lt;/font&gt;&lt;/a&gt;.&lt;/p&gt; &lt;h3&gt;Prerequisites&lt;/h3&gt; &lt;p&gt;In order to complete the example in this topic, you need the following:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Visual Studio 2010.  &lt;li&gt;The ability to send requests using the Simple Object Access Protocol (SOAP) 1.1 and the Hyper Text Transfer Protocol (HTTP 1.1)  &lt;li&gt;The ability to parse SOAP and XML &lt;/li&gt;&lt;/ul&gt; &lt;h3&gt;Creating a Console Application&lt;/h3&gt; &lt;p&gt;This section shows how to create a console application that will use the BING Service.&lt;/p&gt; &lt;p&gt;&lt;b&gt;To create a console application&lt;/b&gt;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Start Visual Studio.  &lt;li&gt;In the File menu, click New, and then click Project.  &lt;li&gt;The New Project dialog box is displayed.  &lt;li&gt;Under Installed Templates, in the left pane, select Visual C# (or Visual Basic).  &lt;li&gt;Then select Windows.  &lt;li&gt;In the right pane, select Console Application.  &lt;li&gt;In the Location box enter the name of the folder where you want to keep the Web application. For example, enter the folder name &lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;C:\CS\SOAP\ConsoleApplications &lt;/span&gt; &lt;li&gt;In the Name box enter the name of the project. For example, enter the name &lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;UsingBingAPI&lt;/span&gt;.  &lt;li&gt;Click OK.  &lt;li&gt;A console application is created. Rename the file Program.cs to &lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;UsingBingAPI.cs&lt;/span&gt;. &lt;/li&gt;&lt;/ol&gt; &lt;h3&gt;Adding a Web Reference to BING Service&lt;/h3&gt; &lt;p&gt;This section shows how to add a Web reference to the BING Service. In order to do that, you use a Web service discovery process by which the client application locates the service and obtains its description. The process of Web service discovery in Visual Studio involves interrogating a Web site to locate the service description, which is an XML document that uses the Web Services Description Language (WSDL). &lt;/p&gt; &lt;p&gt;When you add a Web reference to a project, Visual Studio generates a proxy class that provides a local representation of the Web service, which allows the client code to interface with the Web service. You can access Web service methods by calling the methods in the proxy class. The proxy class handles the communication between the client application and the Web service itself. &lt;/p&gt; &lt;p&gt;&lt;b&gt;To add a Web reference to BING Service&lt;/b&gt;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;In &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;Solution Explorer&lt;/span&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt; &lt;/span&gt;, right-click the project name, and then click &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;Add Service Reference&lt;/span&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;&amp;nbsp;&lt;/span&gt; button.  &lt;li&gt;In the &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;Add Service Reference&lt;/span&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt; &lt;/span&gt;dialog box, click the &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;Advanced...&lt;/span&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;&amp;nbsp;&lt;/span&gt; button.  &lt;li&gt;In the &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;Service Reference Settings&lt;/span&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;&amp;nbsp;&lt;/span&gt; dialog box, click the &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;Add Web Reference...&lt;/span&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;&amp;nbsp;&lt;/span&gt;button.  &lt;li&gt;In the &lt;strong&gt;&lt;font style="background-color: #ffff00" color="#ff0000"&gt;URL&lt;/font&gt;&lt;/strong&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;&amp;nbsp;&lt;/span&gt; box enter the following value: &lt;a href="http://api.search.live.net/search.wsdl" mce_href="http://api.search.live.net/search.wsdl"&gt;&lt;font color="#669966"&gt;http://api.search.live.net/search.wsdl&lt;/font&gt;&lt;/a&gt;.  &lt;li&gt;Click &lt;strong&gt;&lt;font style="background-color: #ffff00" color="#ff0000"&gt;GO&lt;/font&gt;&lt;/strong&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt; &lt;/span&gt;.  &lt;li&gt;If the process has been added successfully a message is displayed saying that "1 Service Found: Search" and the Web reference is: &lt;strong&gt;net.live.search.api&lt;/strong&gt;.  &lt;li&gt;Click &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;Add Reference...&lt;/span&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt; &lt;/span&gt;button.  &lt;li&gt;A Web References folder is added to the project that contains the reference to the live search service.  &lt;li&gt;Also, the app.config file is created and added to the project. This file contains address information about the soap.asmx service. &lt;/li&gt;&lt;/ol&gt; &lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt; &lt;h3&gt;Adding Code to the Console Application to Interact with BING Service&lt;/h3&gt; &lt;p&gt;This section shows the code that provides an interactive menu that enables the user to choose the desired BING service type. Also it shows the code that enables the application to interact with the BING service types. For simplicity only the following types are provided:&lt;/p&gt; &lt;table border="1" cellspacing="0" cellpadding="2" width="482"&gt; &lt;tbody&gt; &lt;tr style="background-color: gray; font-weight: bold" width="201"&gt; &lt;td&gt;SourceType&lt;/td&gt; &lt;td&gt;Function&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="202"&gt;Web&lt;/td&gt; &lt;td valign="top" width="278"&gt;Retrieve information from the Internet&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="203"&gt;InstantAnswer&lt;/td&gt; &lt;td valign="top" width="278"&gt;Retrieve information from the Internet&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="203"&gt;Phonebook&lt;/td&gt; &lt;td valign="top" width="278"&gt;Find location specific information&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;To create the user dialog&lt;/strong&gt; &lt;/p&gt; &lt;p&gt;This section shows how to create the code to provide an interactive menu that enables the user to choose the desired BING service type. &lt;/p&gt; &lt;ol&gt; &lt;li&gt;In &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;Solution Explorer&lt;/span&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt; &lt;/span&gt;, open the file&amp;nbsp; &lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;UsingBingAPI.cs&lt;/span&gt;. and add the code shown next. &lt;/li&gt;&lt;/ol&gt; &lt;blockquote&gt; &lt;p&gt;The code provides an interactive menu that enables the user to choose the desired BING service type among the three listed before.&lt;/p&gt;&lt;/blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Text;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;UsingBingAPI
{
    &lt;span style="color: blue"&gt;#region &lt;/span&gt;ApplicationMain

    &lt;span style="color: blue"&gt;class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ApplicationMain
    &lt;/span&gt;{
        &lt;span style="color: green"&gt;// Display user's menu.
        &lt;/span&gt;&lt;span style="color: blue"&gt;public static void &lt;/span&gt;UserMenu()
        {
            &lt;span style="color: #2b91af"&gt;StringBuilder &lt;/span&gt;buffer = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StringBuilder&lt;/span&gt;();

            buffer.AppendLine(&lt;span style="color: #a31515"&gt;"Please, make your selection."&lt;/span&gt;);
            buffer.AppendLine(&lt;span style="color: #a31515"&gt;"1    -- Using Web SourceType."&lt;/span&gt;);
            buffer.AppendLine(&lt;span style="color: #a31515"&gt;"2    -- Using InstantAnswer SourceType."&lt;/span&gt;);
            buffer.AppendLine(&lt;span style="color: #a31515"&gt;"3    -- Using Phonebook SourceType."&lt;/span&gt;);
            buffer.AppendLine(&lt;span style="color: #a31515"&gt;"?    -- Display help."&lt;/span&gt;);
            buffer.AppendLine(&lt;span style="color: #a31515"&gt;"Q,q  -- Exit the application."&lt;/span&gt;);

            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Write(buffer.ToString());
        }

        &lt;span style="color: green"&gt;// Obtain user's input and provide
        // feedback.
        &lt;/span&gt;&lt;span style="color: blue"&gt;static void &lt;/span&gt;Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args)
        {
            &lt;span style="color: green"&gt;// Define user selection string.
            &lt;/span&gt;&lt;span style="color: blue"&gt;string &lt;/span&gt;selection;

            &lt;span style="color: green"&gt;// Get user selection.
            &lt;/span&gt;&lt;span style="color: blue"&gt;while &lt;/span&gt;(&lt;span style="color: blue"&gt;true&lt;/span&gt;)
            {

                UserMenu();
                &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Write(&lt;span style="color: #a31515"&gt;"&amp;gt; "&lt;/span&gt;);
                selection = &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.ReadLine();
                &lt;span style="color: blue"&gt;if &lt;/span&gt;(selection != &lt;span style="color: blue"&gt;string&lt;/span&gt;.Empty)
                    &lt;span style="color: blue"&gt;break&lt;/span&gt;;
            }

            &lt;span style="color: blue"&gt;while &lt;/span&gt;(selection.ToLower() != &lt;span style="color: #a31515"&gt;"q"&lt;/span&gt;)
            {
                &lt;span style="color: green"&gt;// Process user's input.
                &lt;/span&gt;&lt;span style="color: blue"&gt;switch &lt;/span&gt;(selection)
                {
                    &lt;span style="color: blue"&gt;case &lt;/span&gt;&lt;span style="color: #a31515"&gt;"1"&lt;/span&gt;:
                        &lt;span style="color: green"&gt;// Demonstrate the use of the
                        // Web SourceType over the SOAP Protocol.
                        &lt;/span&gt;WebSample.WebType();
                        &lt;span style="color: blue"&gt;break&lt;/span&gt;;

                    &lt;span style="color: blue"&gt;case &lt;/span&gt;&lt;span style="color: #a31515"&gt;"2"&lt;/span&gt;:
                        &lt;span style="color: green"&gt;// Demonstrate the use of the
                        // InstantAnswer SourceType over the SOAP Protocol.
                        &lt;/span&gt;InstantAnswerFlightStatusSample.Flight();
                        &lt;span style="color: blue"&gt;break&lt;/span&gt;;

                    &lt;span style="color: blue"&gt;case &lt;/span&gt;&lt;span style="color: #a31515"&gt;"3"&lt;/span&gt;:
                        &lt;span style="color: green"&gt;// Demonstrate the use of the
                        // Phonebook SourceType over the SOAP Protocol.
                        &lt;/span&gt;PhonebookSample.Phone();
                        &lt;span style="color: blue"&gt;break&lt;/span&gt;;

                    &lt;span style="color: blue"&gt;default&lt;/span&gt;:
                        UserMenu();
                        &lt;span style="color: blue"&gt;break&lt;/span&gt;;
                }
                &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Write(&lt;span style="color: #a31515"&gt;"&amp;gt; "&lt;/span&gt;);
                selection = &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.ReadLine();
            }
        }
    }
    &lt;span style="color: blue"&gt;#endregion &lt;/span&gt;ApplicationMain
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;strong&gt;To create the code to use with BING Service Web Type&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This section shows how to create the code that enable the application to use BING Service Web type. For more information, see&amp;nbsp; &lt;a href="http://msdn.microsoft.com/en-us/library/dd250886.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd250886.aspx"&gt;&lt;font color="#669966"&gt;WebRequest Class&lt;/font&gt;&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/dd251061.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd251061.aspx"&gt;&lt;font color="#669966"&gt;WebResponse Class&lt;/font&gt;&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/dd250881.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd250881.aspx"&gt;&lt;font color="#669966"&gt;WebResult Class&lt;/font&gt;&lt;/a&gt;. Remember that you need to obtain your AppID and assign it to the AppId constant string, in the code shown next. You obtain the AppID from the &lt;a href="http://www.bing.com/developers" target="_blank" mce_href="http://www.bing.com/developers"&gt;&lt;font color="#669966"&gt;BING Developer Center&lt;/font&gt;&lt;/a&gt;. &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;Solution Explorer&lt;/span&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt; &lt;/span&gt;, create the file&amp;nbsp; &lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;WebSample.cs&lt;/span&gt;. and add the code shown next. The code demonstrates the use of the Web SourceType over the SOAP Protocol. 
&lt;li&gt;Save and close the file. &lt;/li&gt;&lt;/ol&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Xml;

&lt;span style="color: green"&gt;// This using directive assumes that the project's default namespace is
// "UsingBingAPI" and the name of the Bing API web reference is
// "net.live.search.api". Modify this using directive as necessary.
&lt;/span&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;UsingBingAPI.net.live.search.api;

&lt;span style="color: green"&gt;// Bing API 2.1 code sample demonstrating the use of the
// Web SourceType over the SOAP Protocol.
&lt;/span&gt;&lt;span style="color: blue"&gt;static class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WebSample
&lt;/span&gt;{
    &lt;span style="color: green"&gt;// Replace the following string with the AppId you received from the
    // Bing Developer Center.
    &lt;/span&gt;&lt;span style="color: blue"&gt;const string &lt;/span&gt;AppId = &lt;span style="color: #a31515"&gt;"Enter your AppID"&lt;/span&gt;;

    &lt;span style="color: blue"&gt;static public void &lt;/span&gt;WebType()
    {
        &lt;span style="color: green"&gt;// LiveSearchService implements IDisposable.
        &lt;/span&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;(LiveSearchService service = &lt;span style="color: blue"&gt;new &lt;/span&gt;LiveSearchService())
        {
            &lt;span style="color: blue"&gt;try
            &lt;/span&gt;{
                SearchRequest request = BuildRequest();

                &lt;span style="color: green"&gt;// Send the request; display the response.
                &lt;/span&gt;SearchResponse response = service.Search(request);
                DisplayResponse(response);
            }
            &lt;span style="color: blue"&gt;catch &lt;/span&gt;(System.Web.Services.Protocols.SoapException ex)
            {
                &lt;span style="color: green"&gt;// A SOAP Exception was thrown. Display error details.
                &lt;/span&gt;DisplayErrors(ex.Detail);
            }
            &lt;span style="color: blue"&gt;catch &lt;/span&gt;(System.Net.WebException ex)
            {
                &lt;span style="color: green"&gt;// An exception occurred while accessing the network.
                &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(ex.Message);
            }
        }
    }

    &lt;span style="color: blue"&gt;static &lt;/span&gt;SearchRequest BuildRequest()
    {
        SearchRequest request = &lt;span style="color: blue"&gt;new &lt;/span&gt;SearchRequest();

        &lt;span style="color: green"&gt;// Common request fields (required)
        &lt;/span&gt;request.AppId = AppId;
        request.Query = &lt;span style="color: #a31515"&gt;"msdn blogs"&lt;/span&gt;;
        request.Sources = &lt;span style="color: blue"&gt;new &lt;/span&gt;SourceType[] { SourceType.Web };

        &lt;span style="color: green"&gt;// Common request fields (optional)
        &lt;/span&gt;request.Version = &lt;span style="color: #a31515"&gt;"2.0"&lt;/span&gt;;
        request.Market = &lt;span style="color: #a31515"&gt;"en-us"&lt;/span&gt;;
        request.Adult = AdultOption.Moderate;
        request.AdultSpecified = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        request.Options = &lt;span style="color: blue"&gt;new &lt;/span&gt;SearchOption[]
        {
            SearchOption.EnableHighlighting
        };

        &lt;span style="color: green"&gt;// Web-specific request fields (optional)
        &lt;/span&gt;request.Web = &lt;span style="color: blue"&gt;new &lt;/span&gt;WebRequest();
        request.Web.Count = 10;
        request.Web.CountSpecified = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        request.Web.Offset = 0;
        request.Web.OffsetSpecified = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        request.Web.Options = &lt;span style="color: blue"&gt;new &lt;/span&gt;WebSearchOption[]
        {
            WebSearchOption.DisableHostCollapsing,
            WebSearchOption.DisableQueryAlterations
        };

        &lt;span style="color: blue"&gt;return &lt;/span&gt;request;
    }

    &lt;span style="color: blue"&gt;static void &lt;/span&gt;DisplayResponse(SearchResponse response)
    {
        &lt;span style="color: green"&gt;// Display the results header.
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Bing API Version " &lt;/span&gt;+ response.Version);
        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Web results for " &lt;/span&gt;+ response.Query.SearchTerms);
        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
            &lt;span style="color: #a31515"&gt;"Displaying {0} to {1} of {2} results"&lt;/span&gt;,
            response.Web.Offset + 1,
            response.Web.Offset + response.Web.Results.Length,
            response.Web.Total);
        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();

        &lt;span style="color: green"&gt;// Display the Web results.
        &lt;/span&gt;System.Text.&lt;span style="color: #2b91af"&gt;StringBuilder &lt;/span&gt;builder = &lt;span style="color: blue"&gt;new &lt;/span&gt;System.Text.&lt;span style="color: #2b91af"&gt;StringBuilder&lt;/span&gt;();
        &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(WebResult result &lt;span style="color: blue"&gt;in &lt;/span&gt;response.Web.Results)
        {
            builder.Length = 0;
            builder.AppendLine(result.Title);
            builder.AppendLine(result.Description);
            builder.AppendLine(result.Url);
            builder.Append(&lt;span style="color: #a31515"&gt;"Last Crawled: "&lt;/span&gt;);
            builder.AppendLine(result.DateTime);

            DisplayTextWithHighlighting(builder.ToString());
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();
        }
    }

    &lt;span style="color: blue"&gt;static void &lt;/span&gt;DisplayTextWithHighlighting(&lt;span style="color: blue"&gt;string &lt;/span&gt;text)
    {
        &lt;span style="color: green"&gt;// Write text to the standard output stream, changing the console
        // foreground color as highlighting characters are encountered.
        &lt;/span&gt;&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;char &lt;/span&gt;c &lt;span style="color: blue"&gt;in &lt;/span&gt;text.ToCharArray())
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(c == &lt;span style="color: #a31515"&gt;'\uE000'&lt;/span&gt;)
            {
                &lt;span style="color: green"&gt;// If the current character is the begin highlighting
                // character (U+E000), change the console foreground color
                // to green.
                &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.ForegroundColor = &lt;span style="color: #2b91af"&gt;ConsoleColor&lt;/span&gt;.Green;
            }
            &lt;span style="color: blue"&gt;else if &lt;/span&gt;(c == &lt;span style="color: #a31515"&gt;'\uE001'&lt;/span&gt;)
            {
                &lt;span style="color: green"&gt;// If the current character is the end highlighting
                // character (U+E001), revert the console foreground color
                // to gray.
                &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.ForegroundColor = &lt;span style="color: #2b91af"&gt;ConsoleColor&lt;/span&gt;.Gray;
            }
            &lt;span style="color: blue"&gt;else
            &lt;/span&gt;{
                &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Write(c);
            }
        }
    }

    &lt;span style="color: blue"&gt;static void &lt;/span&gt;DisplayErrors(XmlNode errorDetails)
    {
        &lt;span style="color: green"&gt;// Add the default namespace to the namespace manager.
        &lt;/span&gt;XmlNamespaceManager nsmgr = &lt;span style="color: blue"&gt;new &lt;/span&gt;XmlNamespaceManager(
            errorDetails.OwnerDocument.NameTable);
        nsmgr.AddNamespace(
            &lt;span style="color: #a31515"&gt;"api"&lt;/span&gt;,
            &lt;span style="color: #a31515"&gt;"http://schemas.microsoft.com/LiveSearch/2008/03/Search"&lt;/span&gt;);

        XmlNodeList errors = errorDetails.SelectNodes(
            &lt;span style="color: #a31515"&gt;"./api:Errors/api:Error"&lt;/span&gt;,
            nsmgr);

        &lt;span style="color: blue"&gt;if &lt;/span&gt;(errors != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        {
            &lt;span style="color: green"&gt;// Iterate over the list of errors and display error details.
            &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Errors:"&lt;/span&gt;);
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();
            &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(XmlNode error &lt;span style="color: blue"&gt;in &lt;/span&gt;errors)
            {   
                &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(XmlNode detail &lt;span style="color: blue"&gt;in &lt;/span&gt;error.ChildNodes)
                {
                    &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(detail.Name + &lt;span style="color: #a31515"&gt;": " &lt;/span&gt;+ detail.InnerText);
                }

                &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();
            }
        }
    }
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To create the code to use with BING Service InstantAnswer Type&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This section shows how to create the code that enable the application to use BING Service InstantAnswer type. For more information, see &lt;a href="http://msdn.microsoft.com/en-us/library/dd251067.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd251067.aspx"&gt;&lt;font color="#669966"&gt;InstantAnswerResponse Class&lt;/font&gt;&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/dd251026.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd251026.aspx"&gt;&lt;font color="#669966"&gt;InstantAnswerResult Class&lt;/font&gt;&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Remember that you need to obtain your AppID and assign it to the AppId constant string, in the code shown next. You obtain the AppID from the &lt;a href="http://www.bing.com/developers" target="_blank" mce_href="http://www.bing.com/developers"&gt;&lt;font color="#669966"&gt;BING Developer Center&lt;/font&gt;&lt;/a&gt;. &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;Solution Explorer&lt;/span&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt; &lt;/span&gt;, create the file&amp;nbsp; &lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;InstantAnswerFlightStatusSample.cs&lt;/span&gt;. and add the code shown next. The code demonstrates the use of the InstantAnswer SourceType that returns FlightStatus results over the SOAP Protocol. 
&lt;li&gt;Save and close the file. &lt;/li&gt;&lt;/ol&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Xml;

&lt;span style="color: green"&gt;// This using directive assumes that the project's default namespace is
// "UsingBingAPI" and the name of the Bing API web reference is
// "net.live.search.api". Modify this using directive as necessary.
&lt;/span&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;UsingBingAPI.net.live.search.api;

&lt;span style="color: green"&gt;// Bing API 2.2 code sample demonstrating the use of the
// InstantAnswer SourceType to return FlightStatus results over the SOAP Protocol.
&lt;/span&gt;&lt;span style="color: blue"&gt;static class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InstantAnswerFlightStatusSample
&lt;/span&gt;{
    &lt;span style="color: green"&gt;// Replace the following string with the AppId you received from the
    // Bing Developer Center.
    &lt;/span&gt;&lt;span style="color: blue"&gt;const string &lt;/span&gt;AppId = &lt;span style="color: #a31515"&gt;"Enter your AppID"&lt;/span&gt;;

    &lt;span style="color: blue"&gt;static public void &lt;/span&gt;Flight()
    {
        &lt;span style="color: green"&gt;// LiveSearchService implements IDisposable.
        &lt;/span&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;(LiveSearchService service = &lt;span style="color: blue"&gt;new &lt;/span&gt;LiveSearchService())
        {
            &lt;span style="color: blue"&gt;try
            &lt;/span&gt;{
                SearchRequest request = BuildRequest();

                &lt;span style="color: green"&gt;// Send the request; display the response.
                &lt;/span&gt;SearchResponse response = service.Search(request);
                DisplayResponse(response);
            }
            &lt;span style="color: blue"&gt;catch &lt;/span&gt;(System.Web.Services.Protocols.SoapException ex)
            {
                &lt;span style="color: green"&gt;// A SOAP Exception was thrown. Display error details.
                &lt;/span&gt;DisplayErrors(ex.Detail);
            }
            &lt;span style="color: blue"&gt;catch &lt;/span&gt;(System.Net.WebException ex)
            {
                &lt;span style="color: green"&gt;// An exception occurred while accessing the network.
                &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(ex.Message);
            }
        }
    }

    &lt;span style="color: blue"&gt;static &lt;/span&gt;SearchRequest BuildRequest()
    {
        SearchRequest request = &lt;span style="color: blue"&gt;new &lt;/span&gt;SearchRequest();

        &lt;span style="color: green"&gt;// Common request fields (required)
        &lt;/span&gt;request.AppId = AppId;
        request.Query = &lt;span style="color: #a31515"&gt;"CO234"&lt;/span&gt;;
        request.Sources = &lt;span style="color: blue"&gt;new &lt;/span&gt;SourceType[] { SourceType.InstantAnswer };

        &lt;span style="color: green"&gt;// Common request fields (optional)
        &lt;/span&gt;request.Version = &lt;span style="color: #a31515"&gt;"2.2"&lt;/span&gt;;
        request.Market = &lt;span style="color: #a31515"&gt;"en-us"&lt;/span&gt;;
        &lt;span style="color: blue"&gt;return &lt;/span&gt;request;
    }

    &lt;span style="color: blue"&gt;static void &lt;/span&gt;DisplayResponse(SearchResponse response)
    {
        &lt;span style="color: green"&gt;// Display the results header.
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Bing API Version " &lt;/span&gt;+ response.Version);
        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
            &lt;span style="color: #a31515"&gt;"InstantAnswer results for \"" &lt;/span&gt;+ response.Query.SearchTerms + &lt;span style="color: #a31515"&gt;"\" query"&lt;/span&gt;);
        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();

        &lt;span style="color: green"&gt;// Display the InstantAnswer results.
        &lt;/span&gt;&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(InstantAnswerResult result &lt;span style="color: blue"&gt;in &lt;/span&gt;response.InstantAnswer.Results)
        {
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
                &lt;span style="color: #a31515"&gt;"Title: " &lt;/span&gt;+ result.Title);
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
                &lt;span style="color: #a31515"&gt;"ClickThroughUrl: " &lt;/span&gt;+ result.ClickThroughUrl);
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
                &lt;span style="color: #a31515"&gt;"URL: " &lt;/span&gt;+ result.Url);
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
                System.&lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.NewLine + &lt;span style="color: #a31515"&gt;"InstantAnswerSpecificData for FlightStatus"&lt;/span&gt;);
            DisplayInstantAnswerSpecificData(result.InstantAnswerSpecificData);
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();          
        }
    }

    &lt;span style="color: blue"&gt;static void &lt;/span&gt;DisplayInstantAnswerSpecificData(&lt;span style="color: blue"&gt;string &lt;/span&gt;data)
    {
        &lt;span style="color: green"&gt;// Load the InstantAnswer-specific data into an XmlDocument.
        &lt;/span&gt;XmlDocument document = &lt;span style="color: blue"&gt;new &lt;/span&gt;XmlDocument();
        document.Load(&lt;span style="color: blue"&gt;new &lt;/span&gt;System.IO.&lt;span style="color: #2b91af"&gt;StringReader&lt;/span&gt;(data));

        &lt;span style="color: green"&gt;// Add the FlightStatus namespace to the namespace manager.
        &lt;/span&gt;XmlNamespaceManager nsmgr = &lt;span style="color: blue"&gt;new &lt;/span&gt;XmlNamespaceManager(
            document.NameTable);
        nsmgr.AddNamespace(
            &lt;span style="color: #a31515"&gt;"fls"&lt;/span&gt;,
            &lt;span style="color: #a31515"&gt;"http://schemas.microsoft.com/LiveSearch/2008/04/XML/element/flightstatus"&lt;/span&gt;);

        &lt;span style="color: blue"&gt;string &lt;/span&gt;flightName = document.DocumentElement.SelectSingleNode(
    &lt;span style="color: #a31515"&gt;"./fls:FlightName"&lt;/span&gt;,
    nsmgr).InnerText;

        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
            &lt;span style="color: #a31515"&gt;"Flight: " &lt;/span&gt;+ flightName);

        &lt;span style="color: blue"&gt;string &lt;/span&gt;statusString = document.DocumentElement.SelectSingleNode(
            &lt;span style="color: #a31515"&gt;"./fls:StatusString"&lt;/span&gt;,
            nsmgr).InnerText;

        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
            &lt;span style="color: #a31515"&gt;"Status: " &lt;/span&gt;+ statusString);

        &lt;span style="color: blue"&gt;string &lt;/span&gt;originAirportName = document.DocumentElement.SelectSingleNode(
    &lt;span style="color: #a31515"&gt;"./fls:OriginAirport/fls:Name"&lt;/span&gt;,
    nsmgr).InnerText;

        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
            &lt;span style="color: #a31515"&gt;"From: " &lt;/span&gt;+ originAirportName);


        &lt;span style="color: blue"&gt;string &lt;/span&gt;destinationAirportName = document.DocumentElement.SelectSingleNode(
    &lt;span style="color: #a31515"&gt;"./fls:DestinationAirport/fls:Name"&lt;/span&gt;,
    nsmgr).InnerText;

        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
            &lt;span style="color: #a31515"&gt;"To: " &lt;/span&gt;+ destinationAirportName);



        &lt;span style="color: blue"&gt;string &lt;/span&gt;scheduledDeparture = document.DocumentElement.SelectSingleNode(
    &lt;span style="color: #a31515"&gt;"./fls:ScheduledDeparture"&lt;/span&gt;,
    nsmgr).InnerText;

        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
            &lt;span style="color: #a31515"&gt;"Scheduled Departure: " &lt;/span&gt;+ scheduledDeparture);


        &lt;span style="color: blue"&gt;string &lt;/span&gt;scheduledArrival = document.DocumentElement.SelectSingleNode(
    &lt;span style="color: #a31515"&gt;"./fls:ScheduledArrival"&lt;/span&gt;,
    nsmgr).InnerText;

        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
            &lt;span style="color: #a31515"&gt;"Scheduled Arrival: " &lt;/span&gt;+ scheduledArrival);

    }

    &lt;span style="color: blue"&gt;static void &lt;/span&gt;DisplayErrors(XmlNode errorDetails)
    {
        &lt;span style="color: green"&gt;// Add the default namespace to the namespace manager.
        &lt;/span&gt;XmlNamespaceManager nsmgr = &lt;span style="color: blue"&gt;new &lt;/span&gt;XmlNamespaceManager(
            errorDetails.OwnerDocument.NameTable);
        nsmgr.AddNamespace(
            &lt;span style="color: #a31515"&gt;"api"&lt;/span&gt;,
            &lt;span style="color: #a31515"&gt;"http://schemas.microsoft.com/LiveSearch/2008/03/Search"&lt;/span&gt;);

        XmlNodeList errors = errorDetails.SelectNodes(
            &lt;span style="color: #a31515"&gt;"./api:Errors/api:Error"&lt;/span&gt;,
            nsmgr);

        &lt;span style="color: blue"&gt;if &lt;/span&gt;(errors != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        {
            &lt;span style="color: green"&gt;// Iterate over the list of errors and display error details.
            &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Errors:"&lt;/span&gt;);
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();
            &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(XmlNode error &lt;span style="color: blue"&gt;in &lt;/span&gt;errors)
            {
                &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(XmlNode detail &lt;span style="color: blue"&gt;in &lt;/span&gt;error.ChildNodes)
                {
                    &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(detail.Name + &lt;span style="color: #a31515"&gt;": " &lt;/span&gt;+ detail.InnerText);
                }
                &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();
            }
        }
    }
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To create the code to use with BING Service Phonebook Type&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This section shows how to create the code that enable the application to use BING Service Phonebooktype. For more information, see&amp;nbsp; &lt;a href="http://msdn.microsoft.com/en-us/library/dd251009.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd251009.aspx"&gt;&lt;font color="#669966"&gt;PhonebookRequest Class&lt;/font&gt;&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/dd250981.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd250981.aspx"&gt;&lt;font color="#669966"&gt;PhonebookResponse Class&lt;/font&gt;&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/dd250981.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd250981.aspx"&gt;&lt;font color="#669966"&gt;PhonebookResult Class&lt;/font&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Remember that you need to obtain your AppID and assign it to the AppId constant string, in the code shown next. You obtain the AppID from the &lt;a href="http://www.bing.com/developers" target="_blank" mce_href="http://www.bing.com/developers"&gt;&lt;font color="#669966"&gt;BING Developer Center&lt;/font&gt;&lt;/a&gt;. &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;Solution Explorer&lt;/span&gt;&lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt; &lt;/span&gt;, create the file &lt;span style="background-color: yellow; color: blue; font-weight: bold"&gt;PhonebookSample.cs&lt;/span&gt;. and add the code shown next. The code demonstrates the use of the Phonebook SourceType over the SOAP Protocol. 
&lt;li&gt;Save and close the file. &lt;/li&gt;&lt;/ol&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Xml;

&lt;span style="color: green"&gt;// This using directive assumes that the project's default namespace is
// "UsingBingAPI" and the name of the Bing API web reference is
// "net.live.search.api". Modify this using directive as necessary.
&lt;/span&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;UsingBingAPI.net.live.search.api;

&lt;span style="color: green"&gt;// Bing API 2.0 code sample demonstrating the use of the
// Phonebook SourceType over the SOAP Protocol.
&lt;/span&gt;&lt;span style="color: blue"&gt;static class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PhonebookSample
&lt;/span&gt;{
    &lt;span style="color: green"&gt;// Replace the following string with the AppId you received from the
    // Bing Developer Center.
    &lt;/span&gt;&lt;span style="color: blue"&gt;const string &lt;/span&gt;AppId = &lt;span style="color: #a31515"&gt;"Enter your AppID"&lt;/span&gt;;

    &lt;span style="color: blue"&gt;static public void &lt;/span&gt;Phone()
    {
        &lt;span style="color: green"&gt;// LiveSearchService implements IDisposable.
        &lt;/span&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;(LiveSearchService service = &lt;span style="color: blue"&gt;new &lt;/span&gt;LiveSearchService())
        {
            &lt;span style="color: blue"&gt;try
            &lt;/span&gt;{
                SearchRequest request = BuildRequest();

                &lt;span style="color: green"&gt;// Send the request; display the response.
                &lt;/span&gt;SearchResponse response = service.Search(request);
                DisplayResponse(response);
            }
            &lt;span style="color: blue"&gt;catch &lt;/span&gt;(System.Web.Services.Protocols.SoapException ex)
            {
                &lt;span style="color: green"&gt;// A SOAP Exception was thrown. Display error details.
                &lt;/span&gt;DisplayErrors(ex.Detail);
            }
            &lt;span style="color: blue"&gt;catch &lt;/span&gt;(System.Net.WebException ex)
            {
                &lt;span style="color: green"&gt;// An exception occurred while accessing the network.
                &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(ex.Message);
            }
        }
    }

    &lt;span style="color: blue"&gt;static &lt;/span&gt;SearchRequest BuildRequest()
    {
        SearchRequest request = &lt;span style="color: blue"&gt;new &lt;/span&gt;SearchRequest();

        &lt;span style="color: green"&gt;// Common request fields (required)
        &lt;/span&gt;request.AppId = AppId;
        request.Query = &lt;span style="color: #a31515"&gt;"microsoft offices"&lt;/span&gt;;
        request.Sources = &lt;span style="color: blue"&gt;new &lt;/span&gt;SourceType[] { SourceType.Phonebook };

        &lt;span style="color: green"&gt;// Common request fields (optional)
        &lt;/span&gt;request.Version = &lt;span style="color: #a31515"&gt;"2.0"&lt;/span&gt;;
        request.Market = &lt;span style="color: #a31515"&gt;"en-us"&lt;/span&gt;;
        request.UILanguage = &lt;span style="color: #a31515"&gt;"en"&lt;/span&gt;;
        request.Latitude = 47.603450;
        request.LatitudeSpecified = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        request.Longitude = -122.329696;
        request.LongitudeSpecified = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        request.Radius = 10.0;
        request.RadiusSpecified = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        request.Options = &lt;span style="color: blue"&gt;new &lt;/span&gt;SearchOption[]
        {
            SearchOption.EnableHighlighting
        };

        &lt;span style="color: green"&gt;// Phonebook-specific request fields (optional)
        &lt;/span&gt;request.Phonebook = &lt;span style="color: blue"&gt;new &lt;/span&gt;PhonebookRequest();
        request.Phonebook.Count = 10;
        request.Phonebook.CountSpecified = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        request.Phonebook.Offset = 0;
        request.Phonebook.OffsetSpecified = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        request.Phonebook.FileType = &lt;span style="color: #a31515"&gt;"YP"&lt;/span&gt;;
        request.Phonebook.SortBy = PhonebookSortOption.Distance;
        request.Phonebook.SortBySpecified = &lt;span style="color: blue"&gt;true&lt;/span&gt;;

        &lt;span style="color: blue"&gt;return &lt;/span&gt;request;
    }

    &lt;span style="color: blue"&gt;static void &lt;/span&gt;DisplayResponse(SearchResponse response)
    {
        &lt;span style="color: green"&gt;// Display the results header.
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Bing API Version " &lt;/span&gt;+ response.Version);
        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
            &lt;span style="color: #a31515"&gt;"Phonebook results for " &lt;/span&gt;+ response.Query.SearchTerms);
        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(
            &lt;span style="color: #a31515"&gt;"Displaying {0} to {1} of {2} results"&lt;/span&gt;,
            response.Phonebook.Offset + 1,
            response.Phonebook.Offset + response.Phonebook.Results.Length,
            response.Phonebook.Total);
        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();

        &lt;span style="color: green"&gt;// Display the Phonebook results.
        &lt;/span&gt;System.Text.&lt;span style="color: #2b91af"&gt;StringBuilder &lt;/span&gt;builder = &lt;span style="color: blue"&gt;new &lt;/span&gt;System.Text.&lt;span style="color: #2b91af"&gt;StringBuilder&lt;/span&gt;();
        &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(PhonebookResult result &lt;span style="color: blue"&gt;in &lt;/span&gt;response.Phonebook.Results)
        {
            builder.Length = 0;
            builder.AppendLine(result.Business);
            builder.AppendLine(result.Address);
            builder.Append(result.City);
            builder.Append(&lt;span style="color: #a31515"&gt;", "&lt;/span&gt;);
            builder.AppendLine(result.StateOrProvince);
            builder.AppendLine(result.PhoneNumber);
            builder.Append(&lt;span style="color: #a31515"&gt;"Average Rating: "&lt;/span&gt;);
            builder.AppendLine(result.UserRating.ToString());

            DisplayTextWithHighlighting(builder.ToString());
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();
        }
    }

    &lt;span style="color: blue"&gt;static void &lt;/span&gt;DisplayTextWithHighlighting(&lt;span style="color: blue"&gt;string &lt;/span&gt;text)
    {
        &lt;span style="color: green"&gt;// Write text to the standard output stream, changing the console
        // foreground color as highlighting characters are encountered.
        &lt;/span&gt;&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;char &lt;/span&gt;c &lt;span style="color: blue"&gt;in &lt;/span&gt;text.ToCharArray())
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(c == &lt;span style="color: #a31515"&gt;'\uE000'&lt;/span&gt;)
            {
                &lt;span style="color: green"&gt;// If the current character is the begin highlighting
                // character (U+E000), change the console foreground color
                // to green.
                &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.ForegroundColor = &lt;span style="color: #2b91af"&gt;ConsoleColor&lt;/span&gt;.Green;
            }
            &lt;span style="color: blue"&gt;else if &lt;/span&gt;(c == &lt;span style="color: #a31515"&gt;'\uE001'&lt;/span&gt;)
            {
                &lt;span style="color: green"&gt;// If the current character is the end highlighting
                // character (U+E001), revert the console foreground color
                // to gray.
                &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.ForegroundColor = &lt;span style="color: #2b91af"&gt;ConsoleColor&lt;/span&gt;.Gray;
            }
            &lt;span style="color: blue"&gt;else
            &lt;/span&gt;{
                &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Write(c);
            }
        }
    }

    &lt;span style="color: blue"&gt;static void &lt;/span&gt;DisplayErrors(XmlNode errorDetails)
    {
        &lt;span style="color: green"&gt;// Add the default namespace to the namespace manager.
        &lt;/span&gt;XmlNamespaceManager nsmgr = &lt;span style="color: blue"&gt;new &lt;/span&gt;XmlNamespaceManager(
            errorDetails.OwnerDocument.NameTable);
        nsmgr.AddNamespace(
            &lt;span style="color: #a31515"&gt;"api"&lt;/span&gt;,
            &lt;span style="color: #a31515"&gt;"http://schemas.microsoft.com/LiveSearch/2008/03/Search"&lt;/span&gt;);

        XmlNodeList errors = errorDetails.SelectNodes(
            &lt;span style="color: #a31515"&gt;"./api:Errors/api:Error"&lt;/span&gt;,
            nsmgr);

        &lt;span style="color: blue"&gt;if &lt;/span&gt;(errors != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        {
            &lt;span style="color: green"&gt;// Iterate over the list of errors and display error details.
            &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Errors:"&lt;/span&gt;);
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();
            &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(XmlNode error &lt;span style="color: blue"&gt;in &lt;/span&gt;errors)
            {   
                &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(XmlNode detail &lt;span style="color: blue"&gt;in &lt;/span&gt;error.ChildNodes)
                {
                    &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(detail.Name + &lt;span style="color: #a31515"&gt;": " &lt;/span&gt;+ detail.InnerText);
                }

                &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();
            }
        }
    }
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Testing the Console Application &lt;/h3&gt;
&lt;p&gt;This section shows the steps to perform to test the application.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Build the application. 
&lt;li&gt;In a command Window go to the folder where the UsingBingAPI.exe file is located. Most likely the Debug folder. 
&lt;li&gt;Execute the following command: &amp;gt;UsingBingApi. 
&lt;li&gt;A dialog is displayed. 
&lt;li&gt;Make a selection as suggested by the dialog. 
&lt;li&gt;The selected BING service type is invoked and the related results shown. &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;We are done. &lt;/p&gt;
&lt;p&gt;A &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;complete Visual Studio project &lt;/span&gt;is attached next. Please &lt;span style="background-color: yellow; color: red; font-weight: bold"&gt;download and play&lt;/span&gt; with it.&lt;/p&gt;
&lt;p&gt;I appreciate your feedback.&lt;/p&gt;
&lt;h3&gt;See Also&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd251056.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd251056.aspx"&gt;&lt;font color="#669966"&gt;Bing API, Version 2&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd251062.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/library/dd251062.aspx"&gt;&lt;font color="#669966"&gt;Working with Protocols (Bing, Version 2)&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://null/Working%20with%20SourceTypes%20(Bing,%20Version%202)" target="_blank" mce_href="http://null/Working%20with%20SourceTypes%20(Bing,%20Version%202)"&gt;&lt;font color="#669966"&gt;Working with SourceTypes (Bing, Version 2)&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9887595" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/morebits/attachment/9887595.ashx" length="167657" type="application/x-zip-compressed" /></item><item><title>Walkthrough: Filtering Table Rows in Dynamic Data</title><link>http://blogs.msdn.com/morebits/archive/2009/05/19/walkthrough-filtering-table-rows-in-dynamic-data.aspx</link><pubDate>Wed, 20 May 2009 01:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9629843</guid><dc:creator>morebits</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9629843.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9629843</wfw:commentRss><description>&lt;H4&gt;Introduction&lt;/H4&gt;
&lt;P&gt;This walkthrough shows how to use the Dynamic Data filter templates to create the UI that enables you to choose a column value for selecting (filtering) table rows to display. By default, Dynamic Data includes templates that let you specify filtering for Boolean column values and for foreign-key column values. &lt;/P&gt;
&lt;P&gt;In this walkthrough you will build an application that displays filtered rows from tables contained by the AdventureWorksLT sample database, in the following ways:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Filter table rows using a foreign key. You will create the page markup to let Dynamic Data generate the UI and perform row filtering in the Products table by using the foreign-key column values from the ProductCategories table. You use this approach when you want to filter rows for a specific column type for which Dynamic Data provides a default filter template. (If you want to support filtering for a column type for which Dynamic Data does not provide a default filter template, you need to create a custom filter template.)&lt;/LI&gt;
&lt;LI&gt;Filter table rows using default filter templates. You create the page markup to let Dynamic Data automatically generate the UI and perform row filtering in the Products table by using the foreign-key column values from the ProductCategories table, for the column types for which default filter templates exist. By default, Dynamic Data can create the UI for Boolean and foreign-key columns.&lt;/LI&gt;
&lt;LI&gt;Test data filtering. This lets you make sure that Dynamic Data table row filtering capabilities have been integrated in the Web site.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;A Visual Studio project with source code is available to accompany this topic: &lt;A href="http://go.microsoft.com/fwlink/?LinkId=150548" mce_href="http://go.microsoft.com/fwlink/?LinkId=150548"&gt;Download&lt;/A&gt;.&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Prerequisites&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;In order to build the application and run the examples in this topic, you need the following:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A Dynamic Data Web site or a Dynamic Data Web application. You must perform this step to create the AdventureWorksLTDataContext data context and the data model classes to access the tables used in this walkthrough. This walkthrough assumes that you have created the Web site and that you are using a data context that is based on LINQ to SQL. For more information, see Walkthrough: Creating a New Dynamic Data Web Site using Scaffolding1564aef2-9103-436a-9806-c8ad7abd616a.&lt;/LI&gt;
&lt;LI&gt;The AdventureWorksLT sample database. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/dd469575(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd469575(VS.100).aspx"&gt;How to: Connect to the AdventureWorksLT Database with an .MDF File&lt;/A&gt;.&lt;/LI&gt;&lt;/UL&gt;
&lt;H4&gt;&lt;STRONG&gt;Filtering Table Rows Using a Foreign Key&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;This section shows how to create a Web page that let the user filter table rows by using a foreign key. The page contains a T:System.Web.UI.WebControls.LinqDataSource control to interact with the database and a T:System.Web.UI.WebControls.GridView control to display the filtered table rows. The page uses the LINQ to SQL database model, as illustrated in the topic Walkthrough: Creating a New Dynamic Data Web Site using Scaffolding1564aef2-9103-436a-9806-c8ad7abd616a.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;To filter table rows using a foreign key &lt;/B&gt;&lt;/P&gt;
&lt;P&gt;1. In Solution Explorer, right-click the project name, and then select Add New Item. &lt;/P&gt;
&lt;P&gt;2. Under Visual Studio installed templates, select Web Form.&lt;/P&gt;
&lt;P&gt;In the Name box, enter ForeignKeyTableRowFiltering.aspx. &lt;/P&gt;
&lt;P&gt;3. Add a T:System.Web.DynamicData.DynamicDataManager control to the page, as shown in the following example:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;form &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="form1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicDataManager  &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="DynamicDataManager1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;
            
        &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicDataManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;form&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt; 
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;The T:System.Web.DynamicData.DynamicDataManager control must be included on a page in order to support Dynamic Data controls. The markup for the T:System.Web.DynamicData.DynamicDataManager control must precede the markup for any controls that use Dynamic Data.&lt;/P&gt;
&lt;P&gt;4. From the Data tab of the Toolbox, add a T:System.Web.UI.WebControls.LinqDataSource control to the page, as shown in the following example:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;form &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="form1"&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt; runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;LinqDataSource &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LinqDataSource1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"/&amp;gt; &lt;BR&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;form&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;BR&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;5. Set the T:System.Web.UI.WebControls.LinqDataSource control's P:System.Web.UI.WebControls.LinqDataSource.TableName property to the database table to access (Products), as shown in the following example: &lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;LinqDataSource &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LinqDataSource1"&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;TableName&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Products" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;6. Set the P:System.Web.UI.WebControls.LinqDataSource.ContextTypeName property to the data context class (AdventureWorksLTDataContext), as shown in the following example:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;LinqDataSource &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LinqDataSource1"&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server" &lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: red"&gt;   TableName&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Products" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ContextTypeName&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="AdventureWorksLTDataContext"&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;7. From the Data tab of the Toolbox, add a T:System.Web.UI.WebControls.GridView control to the page. &lt;/P&gt;
&lt;P&gt;This control will display the Products table data fields. Set the P:System.Web.UI.WebControls.DataBoundControl.DataSourceID property to the ID of the T:System.Web.UI.WebControls.LinqDataSource control, as shown in the following example:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;form &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="form2" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GridView &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="GridView1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"
        &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataSourceID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LinqDataSource1"&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GridView&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;form&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;8. Set the T:System.Web.UI.WebControls.GridView control's P:System.Web.UI.WebControls.GridView.AutoGenerateColumns property to false, as shown in the following example:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GridView &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="GridView1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataSourceID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LinqDataSource1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;AutoGenerateColumns&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="false"&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GridView&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;This disables the automatic generation of columns that are based on the database table. Instead you will use a DynamicField controls to populate the T:System.Web.UI.WebControls.GridView control.&lt;/P&gt;
&lt;P&gt;9. Optionally, set the T:System.Web.UI.WebControls.GridView control's P:System.Web.UI.WebControls.GridView.AllowPaging and P:System.Web.UI.WebControls.GridView.AllowSorting properties to true, as shown in the following example:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GridView &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="GridView1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataSourceID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LinqDataSource1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;AutoGenerateColumns&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="false"
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;AllowPaging&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="true" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;AllowSorting&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="true"&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GridView&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;10. Add DynamicField controls to the P:System.Web.UI.WebControls.GridView.Columns property and set their P:System.Web.DynamicData.DynamicField.DataField properties to "ProductCategory", "Name", "Color", and "Size". &lt;/P&gt;
&lt;P&gt;DynamicField controls use ASP.NET Dynamic Data to read data from the data model and to format it by using the appropriate field templates. The following example shows the markup for the Columns property and the DynamicField controls:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GridView &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="GridView1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataSourceID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LinqDataSource1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;AutoGenerateColumns&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="false"
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;AllowPaging&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="true" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;AllowSorting&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="true"&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;Columns&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicField &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataField&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="ProductCategory" /&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicField &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataField&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Name" /&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicField &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataField&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Color" /&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicField &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataField&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Size" /&amp;gt;
    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;Columns&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GridView&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;11. Register the T:System.Web.UI.WebControls.GridView control with the T:System.Web.DynamicData.DynamicDataManager control, as shown in the following example:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicDataManager  &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="DynamicDataManager1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DataControls&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DataControlReference &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ControlID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="GridView1" /&amp;gt;
    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DataControls&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicDataManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;12. In the markup above the data-bound control, add a T:System.Web.DynamicData.DynamicFilter control to the page and set the DataField property of the to ProductCategory. &lt;/P&gt;
&lt;P&gt;This is the name of the column to use to for table row filtering. The following example shows the markup for the T:System.Web.DynamicData.DynamicFilter control.&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicFilter &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="DynamicFilter1" 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;   DataField&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="ProductCategory" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server" /&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;Dynamic Data throws an T:System.InvalidOperationException error if the column type does not have an associated filter template.&lt;/P&gt;
&lt;P&gt;13. In the markup above the T:System.Web.DynamicData.DynamicFilter control, add a T:System.Web.UI.WebControls.Label control, as shown in the following example:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;Label &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Label1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server" 
  &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;Text&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="ProductCategory "/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;You will use this Label control to display the name of the column that is used for filtering.&lt;/P&gt;
&lt;P&gt;14. Add a T:System.Web.UI.WebControls.QueryExtender control to the page and set the TargetControlID property to the identifiier of the data source control that you want to extend, as shown in the following example:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryExtender &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="QueryExtender1" 
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;TargetControlID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LinqDataSource1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryExtender&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;The T:System.Web.UI.WebControls.QueryExtender control extends a data source control's capabilities by letting you configure data filtering through declarative syntax, as shown in the next steps.&lt;/P&gt;
&lt;P&gt;15. Add a T:System.Web.DynamicData.DynamicFilterExpression object as a child of the T:System.Web.UI.WebControls.QueryExtender control. Set the ControlID property of the T:System.Web.DynamicData.DynamicFilterExpression object to the identifier of the T:System.Web.DynamicData.DynamicFilter control, as shown in the following example:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryExtender &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="QueryExtender1" 
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;TargetControlID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LinqDataSource1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicFilterExpression &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ControlID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="DynamicFilter1" /&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryExtender&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;16. Save and close the file. &lt;/P&gt;
&lt;P&gt;In Solution Explorer, right-click the ForeignKeyTableRowFiltering.aspx page and then select View in Browser. &lt;/P&gt;
&lt;P&gt;The page displays the columns from the Products and the UI for filtering the products by category.&lt;/P&gt;
&lt;P&gt;17. In the Product Category drop-down control, select a category. &lt;/P&gt;
&lt;P&gt;Dynamic Data filters the products that are displayed, based on the category that you selected.&lt;/P&gt;
&lt;P&gt;18. Close the ForeignKeyTableRowFiltering.aspx page.&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Filtering Table Rows Using Default Filter Templates&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;This section shows how to create a Web page that lets the user filter table rows for the column types for which default filter templates exist. The page contains a T:System.Web.UI.WebControls.LinqDataSource control to interact with the database and a T:System.Web.UI.WebControls.GridView control to display the filtered table rows. The page uses the LINQ to SQL database model, as illustrated in the Walkthrough: Creating a New Dynamic Data Web Site using Scaffolding1564aef2-9103-436a-9806-c8ad7abd616a.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;To filter table rows using default filter templates&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;19. As a shortcut, instead of recreating a new page, in Solution Explorer right-click the ForeignKeyTableRowFiltering.aspx file and then select Copy. &lt;/P&gt;
&lt;P&gt;20. Right-click the project folder and then select Paste.&lt;/P&gt;
&lt;P&gt;21. Right click the Copy of ForeignKeyTableRowFiltering.aspx page and then select Rename. &lt;/P&gt;
&lt;P&gt;22. Rename the file DefaultTableRowFiltering.aspx. &lt;/P&gt;
&lt;P&gt;23. Open the DefaultTableRowFiltering.aspx file. &lt;/P&gt;
&lt;P&gt;24. Add one more DynamicField control to the P:System.Web.UI.WebControls.GridView.Columns property and set the P:System.Web.DynamicData.DynamicField.DataField property to "ProductModel". &lt;/P&gt;
&lt;P&gt;The ProductModel and the ProductCategory columns are the two foreign keys for which Dynamic Data automatically create a UI to filter table rows. The following example shows the markup for the GridView control after you add the new DynamicField control.&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GridView &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="GridView1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataSourceID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LinqDataSource1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;AutoGenerateColumns&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="false"
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;AllowPaging&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="true" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;AllowSorting&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="true"&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;Columns&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicField &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataField&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="ProductCategory" /&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicField &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataField&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="ProductModel" /&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicField &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataField&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Name" /&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicField &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataField&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Color" /&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicField &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataField&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Size" /&amp;gt;
   &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;Columns&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;GridView&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;25. In the markup before the data-bound control, replace the T:System.Web.DynamicData.DynamicFilter control and the T:System.Web.UI.WebControls.Label control with a T:System.Web.DynamicData.QueryableFilterRepeater control, as shown in the following example. &lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryableFilterRepeater &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="FilterRepeater1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryableFilterRepeater&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;26. In the ItemTemplate element of the T:System.Web.DynamicData.QueryableFilterRepeater control, add a T:System.Web.DynamicData.DynamicFilter control, as shown in the following example:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryableFilterRepeater &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="FilterRepeater1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;ItemTemplate&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
        &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicFilter &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="DynamicFilter" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server" /&amp;gt;
    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;ItemTemplate&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryableFilterRepeater&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;The T:System.Web.DynamicData.DynamicFilter control automatically generates a T:System.Web.UI.WebControls.DropDownList control for each column type that has a related default filter template. By default, only Boolean and foreign-key columns have filter templates. The T:System.Web.UI.WebControls.DropDownList control enables the user to select the column value for filtering the table rows.&lt;/P&gt;
&lt;P&gt;27. Add a T:System.Web.UI.WebControls.Label control before the T:System.Web.DynamicData.DynamicFilter control.&lt;/P&gt;
&lt;P&gt;Dynamic Data uses the Label control to display a name for any column that can be used for data filtering. &lt;/P&gt;
&lt;P&gt;The following example shows the markup for a T:System.Web.UI.WebControls.Label that displays the names of the columns to use for data filtering. &lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryableFilterRepeater &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="FilterRepeater1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;ItemTemplate&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;Label &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Label1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server" 
            &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;Text&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;='&lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: #ffee62"&gt;&amp;lt;%&lt;/SPAN&gt;# Eval("DisplayName") &lt;SPAN style="BACKGROUND: #ffee62"&gt;%&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; '/&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicFilter &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="DynamicFilter" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server" /&amp;gt;
    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;ItemTemplate&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryableFilterRepeater&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;28. In the T:System.Web.UI.WebControls.QueryExtender control, set the T:System.Web.DynamicData.DynamicFilterExpression ControlID property to the ID of the T:System.Web.DynamicData.QueryableFilterRepeater control, as shown in the following example:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryExtender &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="QueryExtender1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server" 
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;TargetControlID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="LinqDataSource1"&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicFilterExpression &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ControlID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="FilterRepeater1" /&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryExtender&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;29. Save and close the file.&lt;/P&gt;
&lt;P&gt;30. In Solution Explorer, right-click the DefaultTableRowFiltering.aspx page and then select View in Browser. &lt;/P&gt;
&lt;P&gt;The page displays the defined Products columns and the UI for filtering the products by category and by model.&lt;/P&gt;
&lt;P&gt;31. In the ProductCategory drop-down control, select a category. &lt;/P&gt;
&lt;P&gt;Dynamic Data filters the products displayed based on the category you selected.&lt;/P&gt;
&lt;P&gt;32. In the ProductModel drop-down control, select a model. &lt;/P&gt;
&lt;P&gt;Dynamic Data filters the products displayed based on the model you selected.&lt;/P&gt;
&lt;P&gt;33. Close the browser.&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Testing Table Row Filtering&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;You can now test and compare the table row filtering pages that you just created. This lets you make sure that Dynamic Data filtering capabilities have been integrated in the Web site and compare the methods used. You can interact with the database and verify that the application works as expected. &lt;/P&gt;
&lt;P&gt;&lt;B&gt;To test and compare table row filtering&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;34. In Solution Explorer, right-click the ForeignKeyTableRowFiltering.aspx page and then select View in Browser. &lt;/P&gt;
&lt;P&gt;The page displays the defined Products columns and the UI for filtering the products by category. Notice that this is the column that you specifically configured to create the UI for table row filtering.&lt;/P&gt;
&lt;P&gt;35. Close the ForeignKeyTableRowFiltering.aspx page.&lt;/P&gt;
&lt;P&gt;36. In Solution Explorer, right-click the DefaultTableRowFiltering.aspx page and then select View in Browser. &lt;/P&gt;
&lt;P&gt;The page displays the defined Products columns and the UI for filtering the products by category and by model. Notice that Dynamic Data has automatically created a UI for category and model filtering. This shows how you can use declarative syntax to instruct Dynamic Data to generate the UI and table row filtering for all the column types for which a default filter template exists. &lt;/P&gt;
&lt;P&gt;37. Close the browser.&lt;/P&gt;
&lt;H4&gt;Next Steps&lt;/H4&gt;
&lt;P&gt;This walkthrough has illustrated the basic principles of how to add data filtering to an ASP.NET Dynamic Data Web site. You have seen how to enable data filtering using a specific column or automatically. You might want to experiment with additional features. Suggestions for additional exploration include the following:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Learn how to enable data-key filtering. This enables the user to filter table rows based on the column value from a parent table. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/dd329362(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd329362(VS.100).aspx"&gt;How to: Filter Data Using Values from a Parent Table in Dynamic Data&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Learn how to customize a specific table layout. This is to customize the layout for a specific table that could allow for custom UI for data filtering. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/dd723645(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd723645(VS.100).aspx"&gt;Walkthrough: Customizing Table layout Using Entity Templates&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;For general information, you might want to do the following:&lt;/LI&gt;
&lt;LI&gt;Understand how to use the vs_ordesigner_short in a Web application to create data classes that represent a SQL Server database. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/bb907587(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb907587(VS.100).aspx"&gt;How to: Create LINQ to SQL Classes in a Web Application&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Understand LINQ-to-SQL Object-Relational mapping. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/bb386976(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb386976(VS.100).aspx"&gt;LINQ to SQL&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Understand the Object Relational Designer (O/R Designer). For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/bb384429(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb384429(VS.100).aspx"&gt;Object Relational Designer (O/R Designer)&lt;/A&gt;.&lt;/LI&gt;&lt;/UL&gt;
&lt;H4&gt;See Also&lt;/H4&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd329362(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd329362(VS.100).aspx"&gt;How to: Filter Data Using Values from a Parent Table in Dynamic Data&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd329553(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd329553(VS.100).aspx"&gt;How to: Filter Table Rows Using Foreign Key in Dynamic Data&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd490941(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd490941(VS.100).aspx"&gt;How to: Filter Table Rows Using Default Filter Templates in Dynamic Data&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc488546(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc488546(VS.100).aspx"&gt;ASP.NET Dynamic Data Overview&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9629843" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/morebits/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category></item><item><title>Customize Table Rows Filtering in Dynamic Data</title><link>http://blogs.msdn.com/morebits/archive/2009/04/14/customize-table-rows-filtering-in-dynamic-data.aspx</link><pubDate>Tue, 14 Apr 2009 02:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9547490</guid><dc:creator>morebits</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9547490.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9547490</wfw:commentRss><description>&lt;H2&gt;&lt;STRONG&gt;Introduction&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;ASP.NET Dynamic Data enables you to use page markup to filter the table rows to display and provides the UI that enables the user to enter the values needed for custom row filtering. Dynamic Data will infer the filter template for creating the UI based on the column type. By default, Boolean and foreign-key columns are used for filtering. &lt;/P&gt;
&lt;P&gt;Custom filtering requires the following steps:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Define table row filtering. Add a &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.DynamicData.DynamicFilter&lt;/STRONG&gt;&lt;/SPAN&gt; control and configure it for the desired filtering column. This allows for creating the UI that enables the user to perform table row filtering. &lt;/LI&gt;
&lt;LI&gt;Define data source filtering information. Add a &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.UI.WebControls.QueryExtender &lt;/STRONG&gt;&lt;/SPAN&gt;and configure it to reference the &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.DynamicData.DynamicFilter&lt;/STRONG&gt;&lt;/SPAN&gt; control. This allows for passing filtering information to the data source control on the page. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;This lets you perform data filtering by using simple page markup without requiring knowledge of the data source control and of the database query details. &lt;/P&gt;
&lt;P&gt;Multiple &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.DynamicData.DynamicFilter&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp; controls can be used to allow for multiple filtering criteria.&lt;/P&gt;
&lt;P&gt;The following figure shows the process that Dynamic Data elements follow in order to implement filtering.&lt;/P&gt;
&lt;P&gt;These are the steps followed: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.DynamicData.DynamicFilter&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp; control passes the user's selected value to the &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.UI.WebControls.QueryExtender &lt;/STRONG&gt;&lt;/SPAN&gt;control. &lt;/LI&gt;
&lt;LI&gt;The &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.UI.WebControls.QueryExtender &lt;/STRONG&gt;&lt;/SPAN&gt;control uses the value to create the query filtering information. Then it passes this information to the data source control. &lt;/LI&gt;
&lt;LI&gt;The data source control passes the filtering query information to the data source provider. &lt;/LI&gt;
&lt;LI&gt;The data source provider passes the query to the database. &lt;/LI&gt;
&lt;LI&gt;The database returns the filtered table rows. &lt;/LI&gt;
&lt;LI&gt;The data source provider sends this data back to the data source control. &lt;/LI&gt;
&lt;LI&gt;This control finally passes the filtered table rows to the data-bound control for display. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;STRONG&gt;Dynamic Data Table Rows Filtering Elements&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/CustomizeTableRowsFilteringinDynamicData_DA15/QueryTablesDefaultFilterTemplates_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/CustomizeTableRowsFilteringinDynamicData_DA15/QueryTablesDefaultFilterTemplates_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" border=0 alt=QueryTablesDefaultFilterTemplates src="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/CustomizeTableRowsFilteringinDynamicData_DA15/QueryTablesDefaultFilterTemplates_thumb.jpg" width=302 height=391 mce_src="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/CustomizeTableRowsFilteringinDynamicData_DA15/QueryTablesDefaultFilterTemplates_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;H2&gt;&lt;STRONG&gt;Procedures&lt;/STRONG&gt;&lt;/H2&gt;
&lt;H4&gt;&lt;B&gt;To define table row filtering&lt;/B&gt;&lt;/H4&gt;
&lt;OL&gt;
&lt;LI&gt;In Visual Studio, in a Dynamic Data Web site, create or open an ASP.NET Web page. The procedure assumes that a data source control to access the database and a related data-bound control to display the tables exist. &lt;/LI&gt;
&lt;LI&gt;Add a &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.DynamicData.DynamicFilter&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp; control to the page. Set the DataField property to the name of the column that is used to filter the rows from the table. The following example shows the markup for a &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.DynamicData.DynamicFilter&lt;/STRONG&gt;&lt;/SPAN&gt; control that specifies the name of the column to use for data filtering. &lt;/LI&gt;&lt;/OL&gt;
&lt;BLOCKQUOTE&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicFilter &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="CategoryFilterID"&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="BACKGROUND-COLOR: yellow; COLOR: red; FONT-WEIGHT: bold"&gt;DataField&lt;/SPAN&gt;&lt;SPAN style="BACKGROUND-COLOR: yellow; COLOR: blue; FONT-WEIGHT: bold"&gt;="ProductCategory" &lt;/SPAN&gt;  &lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Dynamic Data will infer the filter template to use based on the column type. It will throw a &lt;A href="http://msdn.microsoft.com/en-us/library/system.invalidoperationexception.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/system.invalidoperationexception.aspx"&gt;System.InvalidOperationException&lt;/A&gt; if the column type does not have an associated default filter template.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;H4&gt;&lt;B&gt;To define data source filtering information&lt;/B&gt;&lt;/H4&gt;
&lt;OL&gt;
&lt;LI&gt;Add a &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.UI.WebControls.QueryExtender &lt;/STRONG&gt;&lt;/SPAN&gt;control to the page. Set the TargetControlID property to the ID of the data source control that you want to extend. The following example shows the markup for a &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.UI.WebControls.QueryExtender&lt;/STRONG&gt;&lt;/SPAN&gt; control that points to the extended data source control.&amp;nbsp; &lt;/LI&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp:QueryExtender&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="QueryExtenderID"&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;STRONG&gt;&lt;FONT style="BACKGROUND-COLOR: #ffff00" color=#ff0000&gt;TargetControlID&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN style="BACKGROUND-COLOR: yellow; COLOR: blue; FONT-WEIGHT: bold"&gt;="GridDataSource" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"/&amp;gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;asp:QueryExtender&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;LI&gt;Add a &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.UI.WebControls.DynamicFilterExpression &lt;/STRONG&gt;&lt;/SPAN&gt;object as a child of the &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.UI.WebControls.QueryExtende &lt;/STRONG&gt;&lt;/SPAN&gt;control &lt;/LI&gt;
&lt;LI&gt;Set the &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.UI.WebControls.DynamicFilterExpression &lt;/STRONG&gt;&lt;/SPAN&gt;ControlID property to the identifier of the &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.DynamicData.DynamicFilter&lt;/STRONG&gt;&lt;/SPAN&gt; control.The following example shows the markup for a &lt;SPAN style="COLOR: blue"&gt;&lt;STRONG&gt;System.Web.UI.WebControls.QueryExtende &lt;/STRONG&gt;&lt;/SPAN&gt;control that includes the filter to use for querying the database. &lt;/LI&gt;&lt;/OL&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp:QueryExtender&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="QueryExtenderID"&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;STRONG&gt;&lt;FONT style="BACKGROUND-COLOR: #ffff00" color=#ff0000&gt;TargetControlID&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN style="BACKGROUND-COLOR: yellow; COLOR: blue; FONT-WEIGHT: bold"&gt;="GridDataSource" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp:DynamicFilterExpression&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="CategoryFilterID"&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;asp:QueryExtender&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;H3&gt;Example&lt;/H3&gt;
&lt;P&gt;The following example uses the ForeignKey.ascx filter template to create a &lt;A href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist.aspx"&gt;System.Web.UI.WebControls.DropDownList&lt;/A&gt; control for the Products foreign key column ProductCategory. When the user selects a value from this control, the example displays only those Products table rows that contain that value. &lt;/P&gt;
&lt;P&gt;Refer to the attached files.&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue; FONT-WEIGHT: bold"&gt;Note: &lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="COLOR: blue; FONT-WEIGHT: bold"&gt;Dynamic Data defaults to the Boolean filter template. You do not need to specify it. The example just shows how to apply a filter template to a specific data field, if you need to.&lt;/SPAN&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="COLOR: blue; FONT-WEIGHT: bold"&gt;The &lt;FONT color=#ff0000&gt;aspX&lt;/FONT&gt; prefix is temporary for this preview. It will change to &lt;FONT color=#ff0000&gt;asp&lt;/FONT&gt; in the final release.&lt;/SPAN&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Compiling the Code&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;This example requires the following:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A Dynamic Data Web site or a Dynamic Data Web application. &lt;/LI&gt;
&lt;LI&gt;The AdventureWorksLT sample database. · &lt;/LI&gt;
&lt;LI&gt;A data context object that is registered in the Global.asax file. &lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9547490" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/morebits/attachment/9547490.ashx" length="2173" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/morebits/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category></item><item><title>Configuration API: Using System.Configuration.ConfigurationManager</title><link>http://blogs.msdn.com/morebits/archive/2009/02/04/configuration-api-using-system-configuration-configurationmanager.aspx</link><pubDate>Wed, 04 Feb 2009 23:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9396556</guid><dc:creator>morebits</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9396556.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9396556</wfw:commentRss><description>&lt;FONT face=Verdana&gt;
&lt;P class=MsoNormal style="MARGIN: 3pt 0in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa"&gt;&lt;STRONG&gt;Summary:&lt;/STRONG&gt; This post shows a console application that uses the &lt;A href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx"&gt;ConfigurationManager&lt;/A&gt; class. The code example extends what is already in the current documentation to demonstrate the use of this class. The example has been built using Microsoft Visual Studio 2008 and the .NET Framework 3.5. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 3pt 0in"&gt;The &lt;A href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx"&gt;ConfigurationManager&lt;/A&gt; class enables a Web or Windows application to access machine, application, and user configuration files. The&amp;nbsp; name and location of the configuration files depend on whether you are working with a Web application or a Windows console application. For more information, see &lt;A href="http://msdn.microsoft.com/en-us/library/ms229689.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms229689.aspx"&gt;Application Configuration Files&lt;/A&gt;. &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 3pt 0in" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 3pt 0in" mce_keep="true"&gt;You can use this example to build a console application by simply replacing the program file in a console project. For information about how to build a console application, see &lt;A href="http://msdn.microsoft.com/en-us/library/ms438026.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms438026.aspx"&gt;How to: Create a Console Application&lt;/A&gt;. &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 3pt 0in" mce_keep="true"&gt;&lt;SPAN class=LanguageKeyword&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp; To compile this example, you must add a reference to the System.Configuration assembly to the&amp;nbsp; project&lt;/SPAN&gt;. &lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/FONT&gt;
&lt;P class=MsoNormal style="MARGIN: 3pt 0in"&gt;&lt;SPAN style="FONT-FAMILY: 'Times New Roman'"&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;FONT color=#808080&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-bidi-font-family: arial"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 18pt; FONT-FAMILY: arial"&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;
&lt;P class=MsoNormal style="MARGIN: 3pt 0in"&gt;The example works with a custom configuration section that stores color information for the background and foreground of the console window. The custom configuration section lets you do the following: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=BulletedList1 style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;SPAN style="mso-fareast-font-family: symbol"&gt;Create custom information to store in several configuration files, such as the configuration file for roaming users and the default application configuration file that applies to all users. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class=BulletedList1 style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;SPAN style="mso-fareast-font-family: symbol"&gt;Specify what configuration file and where in the configuration hierarchy the section can be stored or overridden. 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P class=MsoNormal style="MARGIN: 3pt 0in"&gt;The example contains the classes described next and shown in the following picture:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 3pt 0in"&gt;&lt;A href="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/ConfigurationAPIUsi.ConfigurationManager_AA30/ConfigurationManagerSample_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/ConfigurationAPIUsi.ConfigurationManager_AA30/ConfigurationManagerSample_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; MARGIN: 5px 5px 5px 10px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=273 alt=ConfigurationManagerSample src="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/ConfigurationAPIUsi.ConfigurationManager_AA30/ConfigurationManagerSample_thumb.jpg" width=435 border=0 mce_src="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/ConfigurationAPIUsi.ConfigurationManager_AA30/ConfigurationManagerSample_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 3pt 0in"&gt;&lt;STRONG&gt;ConsoleSection&lt;/STRONG&gt;. This class defines a custom section that the application uses to create custom configuration sections at the specified level in the configuration hierarchy (that is, in the appropriate configuration files). This enables users who have sufficient access rights to make changes to the configuration files. &lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 3pt 0in"&gt;&lt;STRONG&gt;ConsoleElement&lt;/STRONG&gt;. This class is used by &lt;STRONG&gt;CustomSection&lt;/STRONG&gt;. This element stores background and foreground colors that the application applies to the console window. &lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa"&gt;The console color information is stored in different configuration files. The values used to define colors depend on which file the color settings are stored in.&lt;/SPAN&gt; &lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 3pt 0in"&gt;&lt;STRONG&gt;UsingConfigurationManager&lt;/STRONG&gt;. This class is the example core class and is used by the application to exercise the main &lt;SPAN style="FONT-FAMILY: arial"&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx"&gt;&lt;SPAN style="FONT-FAMILY: verdana"&gt;ConfigurationManager&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt; capabilities. It performs the following tasks: &lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=textinlist1 style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;·&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 7pt; mso-fareast-font-family: symbol"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; mso-bidi-font-family: arial"&gt;Gets the roaming configuration file associated with the application. &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: arial"&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P class=textinlist1 style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;·&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 7pt; mso-fareast-font-family: symbol"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; mso-bidi-font-family: arial"&gt;Gets the application configuration file associated with the application. &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: arial"&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P class=bulletedlist10 style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;·&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 7pt; mso-fareast-font-family: symbol"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; mso-bidi-font-family: arial"&gt;Accesses a specified configuration file through mapping. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=bulletedlist10 style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;·&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 7pt; mso-fareast-font-family: symbol"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; mso-bidi-font-family: arial"&gt;Accesses the machine configuration file through mapping. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=bulletedlist10 style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;·&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 7pt; mso-fareast-font-family: symbol"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; mso-bidi-font-family: arial"&gt;Reads a specified configuration section. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=bulletedlist10 style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;·&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 7pt; mso-fareast-font-family: symbol"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; mso-bidi-font-family: arial"&gt;Reads the &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: arial"&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/bf7sd233(VS.80).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bf7sd233(VS.80).aspx"&gt;&lt;SPAN style="FONT-FAMILY: verdana"&gt;connectionStrings&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; mso-bidi-font-family: arial"&gt; section. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=bulletedlist10 style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;·&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 7pt; mso-fareast-font-family: symbol"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; mso-bidi-font-family: arial"&gt;Reads or writes the &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: arial"&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms228154.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms228154.aspx"&gt;&lt;SPAN style="FONT-FAMILY: verdana"&gt;appSettings&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; mso-bidi-font-family: arial"&gt; section. &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: arial"&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 3pt 0in"&gt;&lt;STRONG&gt;ApplicationMain&lt;/STRONG&gt;. This class contains the application &lt;STRONG&gt;&lt;PLACE w:st="on"&gt;Main&lt;/PLACE&gt;&lt;/STRONG&gt; function and is used to obtain user's input and to provide feedback. It exercises the &lt;STRONG&gt;ConfigurationManager&lt;/STRONG&gt; by calling its methods, based on the user's selection. &lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;For a complete example, see the attached files.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We look forward to &lt;B style="mso-bidi-font-weight: normal"&gt;your comments and feedback. &lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 3pt 0in"&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 3pt 0in"&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9396556" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/morebits/attachment/9396556.ashx" length="102591" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/morebits/archive/tags/Configuration/default.aspx">Configuration</category></item><item><title>Querying a Table By a Data Key in Dynamic Data</title><link>http://blogs.msdn.com/morebits/archive/2009/01/30/querying-dynamic-data-table-by-a-data-key.aspx</link><pubDate>Fri, 30 Jan 2009 07:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9384242</guid><dc:creator>morebits</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9384242.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9384242</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;: Query a child table using a column from a parent table. A simpler example of this would be if the column belongs to the same table. This topic uses two tables related by a parent-child relationship. The parent table contains the data key that is the foreign key in the child table. See the following picture.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/QueryingDynamicDataTableByDataKey_EE23/ForeignKey.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="222" alt="ForeignKey" src="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/QueryingDynamicDataTableByDataKey_EE23/ForeignKey_thumb.jpg" width="413" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;A query is built based on the values assigned to the foreign key. The selection of the values for querying the data source is performed in a source data-bound control. The results of the query are shown in a target data-bound control.&lt;/p&gt;  &lt;h2&gt;Under the Hood&lt;/h2&gt;  &lt;p&gt;The following picture shows the main elements involved during querying (filtering).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/QueryingDynamicDataTableByDataKey_EE23/Data%20Key%20Filtering%20Elements_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="438" alt="Data Key Filtering Elements" src="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/QueryingDynamicDataTableByDataKey_EE23/Data%20Key%20Filtering%20Elements_thumb.jpg" width="540" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h2&gt;Procedural Steps&lt;/h2&gt;  &lt;p&gt;To query a table by a data key, you must perform the following steps:&lt;/p&gt;  &lt;h3&gt;Setting the Source Data-Bound Control&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;In a page, declare the source data-bound control to display the data from the &lt;span style="color: red"&gt;&lt;strong&gt;Categories&lt;/strong&gt;&lt;/span&gt;&amp;#160; parent table. Sets its &lt;span style="color: red"&gt;&lt;strong&gt;DataSourceID&lt;/strong&gt;&lt;/span&gt; property to point to the data source control that queries the table. The following example shows how to do it:       &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridView &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SourceGridView&amp;quot;&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;span style="font-weight: bold; color: red; background-color: yellow"&gt;DataSourceID&lt;/span&gt;&lt;span style="font-weight: bold; color: blue; background-color: yellow"&gt;=&amp;quot;GridDataSource&amp;quot; &lt;/span&gt;  &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
    &lt;span style="color: blue"&gt;&lt;font color="#ff0000"&gt;.........&lt;/font&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&lt;/span&gt; 

    &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridView&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
    &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;Declare the data source control that queries the &lt;span style="color: red"&gt;&lt;strong&gt;Categories&lt;/strong&gt;&lt;/span&gt;&amp;#160; parent table. The following example shows how to do it: &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;aspX&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinqDataSource &lt;span style="font-weight: bold; color: red; background-color: yellow"&gt;ID&lt;/span&gt;&lt;span style="font-weight: bold; color: blue; background-color: yellow"&gt;=&amp;quot;GridDataSource&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;EnableDelete&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; 
               &lt;/span&gt;&lt;span style="color: red"&gt;EnableUpdate&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ContextTypeName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;DynamicDataProject.NorthwindDataContext&amp;quot;
               &lt;span style="font-weight: bold; color: red; background-color: yellow"&gt;TableName&lt;/span&gt;&lt;span style="font-weight: bold; color: blue; background-color: yellow"&gt;=&amp;quot;Categories&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;aspX&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinqDataSource&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;p&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;h3&gt;Setting the Target Data-Bound Control&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Declare the target data-bound control to display the data from the &lt;span style="color: red"&gt;&lt;strong&gt;Products&lt;/strong&gt;&lt;/span&gt; child table. Sets its &lt;span style="color: red"&gt;&lt;strong&gt;DataSourceID&lt;/strong&gt;&lt;/span&gt; property to point to the data source control that queries the table. The following example shows how to do it: 

    &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridView &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TargetGridView&amp;quot; &lt;/span&gt;&lt;span style="color: blue"&gt; &lt;span style="font-weight: bold; color: red; background-color: yellow"&gt;DataSourceID&lt;/span&gt;&lt;span style="font-weight: bold; color: blue; background-color: yellow"&gt;=&amp;quot;DetailsDataSource&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
    &lt;span style="color: blue"&gt;&lt;font color="#ff0000"&gt;.........&lt;/font&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&lt;/span&gt; 

    &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridView&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
    &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;Declare the data source control that queries the &lt;span style="color: red"&gt;&lt;strong&gt;Products&lt;/strong&gt;&lt;/span&gt; child table. The following example shows how to do it: &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;aspX&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinqDataSource &lt;span style="font-weight: bold; color: red; background-color: yellow"&gt;ID&lt;/span&gt;&lt;span style="font-weight: bold; color: blue; background-color: yellow"&gt;=&amp;quot;DetailsDataSource&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;EnableDelete&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; 
               &lt;/span&gt;&lt;span style="color: red"&gt;EnableUpdate&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ContextTypeName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;DynamicDataProject.NorthwindDataContext&amp;quot;
               &lt;span style="font-weight: bold; color: red; background-color: yellow"&gt;TableName&lt;/span&gt;&lt;span style="font-weight: bold; color: blue; background-color: yellow"&gt;=&amp;quot;Products&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;aspX&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinqDataSource&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;span style="font-weight: bold; color: blue"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h3&gt;Setting the Query&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Declare the &lt;em&gt;&amp;lt;asp:QueryExtender&amp;gt;&lt;/em&gt; control. Sets its &lt;span style="color: red"&gt;&lt;strong&gt;TargetControlID&lt;/strong&gt;&lt;/span&gt; property to point to the data source control that queries the &lt;span style="color: red"&gt;&lt;strong&gt;Products&lt;/strong&gt;&lt;/span&gt; child table. &lt;/li&gt;

  &lt;li&gt;Declare the &lt;em&gt;&amp;lt;asp:ControlFilterExpression&amp;gt;&lt;/em&gt; as a child of the &lt;em&gt;&amp;lt;asp:QueryExtender&amp;gt;&lt;/em&gt; control.&amp;#160;&amp;#160; Sets its &lt;span style="color: red"&gt;&lt;strong&gt;ControlID&lt;/strong&gt;&lt;/span&gt; property to point to the source data-bound control. Sets its &lt;span style="color: red"&gt;&lt;strong&gt;Column&lt;/strong&gt;&lt;/span&gt; property to point to the &lt;span style="color: red"&gt;&lt;strong&gt;Category&lt;/strong&gt;&lt;/span&gt; column in the &lt;span style="color: red"&gt;&lt;strong&gt;Categories&lt;/strong&gt;&lt;/span&gt; parent table. This enables you to filter products based on category values.&amp;#160;&amp;#160; The following example shows how to do it: &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;aspX&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;QueryExtender &lt;span style="font-weight: bold; color: red; background-color: yellow"&gt;TargetControlID&lt;/span&gt;&lt;span style="font-weight: bold; color: blue; background-color: yellow"&gt;=&amp;quot;DetailsDataSource&amp;quot; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;ControlFilterExpression  &lt;span style="font-weight: bold; color: red; background-color: yellow"&gt;ControlD&lt;/span&gt;&lt;span style="font-weight: bold; color: blue; background-color: yellow"&gt;=&amp;quot;SourceGridView&amp;quot;&lt;/span&gt;  &lt;span style="font-weight: bold; color: red; background-color: yellow"&gt;Column&lt;/span&gt;&lt;span style="font-weight: bold; color: blue; background-color: yellow"&gt;=&amp;quot;Category&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;aspX&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;QueryExtender&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;span&gt;Note: &lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;span style="font-weight: bold; color: blue"&gt;The &lt;font color="#ff0000"&gt;aspX&lt;/font&gt; prefix is temporary for the current Dynamic Data preview. It will change to &lt;font color="#ff0000"&gt;asp&lt;/font&gt; in the final release.&lt;/span&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a complete example, see the attached files. &lt;/p&gt;

&lt;p mce_keep="true"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9384242" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/morebits/attachment/9384242.ashx" length="3461" type="application/x-zip-compressed" /></item><item><title>Querying a Table By a Column using Dynamic Data Filtering</title><link>http://blogs.msdn.com/morebits/archive/2009/01/13/common-steps-to-apply-a-filter-template-to-a-data-field.aspx</link><pubDate>Tue, 13 Jan 2009 05:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9312287</guid><dc:creator>morebits</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9312287.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9312287</wfw:commentRss><description>&lt;P&gt;&lt;STRONG&gt;&lt;A href="http://blogs.msdn.com/morebits/archive/2009/04/14/customize-table-rows-filtering-in-dynamic-data.aspx" mce_href="http://blogs.msdn.com/morebits/archive/2009/04/14/customize-table-rows-filtering-in-dynamic-data.aspx"&gt;Please refer to Customize Table Rows Filtering in Dynamic Data&lt;/A&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9312287" width="1" height="1"&gt;</description></item><item><title>Querying a Table By a Foreign Key using Dynamic Data Filter </title><link>http://blogs.msdn.com/morebits/archive/2009/01/10/querying-products-by-category.aspx</link><pubDate>Sat, 10 Jan 2009 05:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9303235</guid><dc:creator>morebits</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9303235.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9303235</wfw:commentRss><description>&lt;P&gt;&lt;STRONG&gt;Summary&lt;/STRONG&gt;: This post shows how to query a child table using a column from a parent table in dynamic data filtering.&amp;nbsp; It shows how to use the &lt;EM&gt;ForeignKey&lt;/EM&gt; filter template to query the products using the &lt;EM&gt;Category&lt;/EM&gt; data field. The &lt;EM&gt;ForeignKey&lt;/EM&gt; filter template is specified declaratively. This is because it must override the &lt;EM&gt;MultiForeignKey &lt;/EM&gt;template specified in the partial class or data model.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;: You specify the filter template in the data model when you want to apply it globally to your application. You specify it in a page when you want to apply it just to that page.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The &lt;FONT color=#ff0000&gt;&lt;EM&gt;ForeignKey&lt;/EM&gt; filter template&lt;/FONT&gt; &lt;FONT color=#ff0000&gt;displays a drop-down list&lt;/FONT&gt;. This enables the user to select a category when displaying the products. By default all the categories are selected so that all the products are displayed. The &lt;EM&gt;ForeignKey &lt;/EM&gt;filter template enables the selection of only one category at the time. By contrast, the &lt;EM&gt;MultiForeignKey&lt;/EM&gt; filter template enables the selection of multiple categories. &lt;BR&gt;The &lt;EM&gt;Category&lt;/EM&gt; data field, to which the filter is applied, represents a foreign key (FK). As consequence, the &lt;EM&gt;ForeignKey&lt;/EM&gt; filter obtains its selection values from the &lt;EM&gt;Category&lt;/EM&gt; table. &lt;/P&gt;
&lt;P&gt;The following are the key steps to filter the products by &lt;EM&gt;Category: &lt;/EM&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Declare the filter template to reference. You do this using the &lt;EM&gt;&amp;lt;asp:DynamicFilter&amp;gt;&lt;/EM&gt; control as follows: &lt;/LI&gt;&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicFilter  &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="&lt;STRONG&gt;CategoryFilterID&lt;/STRONG&gt;"  &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;Filter&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="ForeignKey"
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;DataField&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Category" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;OnFilterChanged&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="OnFilterSelectedIndexChanged" /&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;UL&gt;
&lt;LI&gt;Add the &lt;EM&gt;&amp;lt;asp:DynamicFilterExpression&amp;gt;&lt;/EM&gt; as an element of the &lt;EM&gt;&amp;lt;asp:QueryExtender&amp;gt;&lt;/EM&gt; control. Set its &lt;STRONG&gt;ControlID&lt;/STRONG&gt; property to point to the previously declared&amp;nbsp; filter as follows: &lt;/LI&gt;&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;aspX&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryExtender &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="QueryExtender1" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;TargetControlID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="GridDataSource" &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&amp;gt;
      &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;DynamicFilterExpression &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;ControlID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="&lt;STRONG&gt;CategoryFilterID&lt;/STRONG&gt;" /&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;aspX&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;QueryExtender&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;For a complete example, see the attached files. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9303235" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/morebits/attachment/9303235.ashx" length="3145" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/morebits/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category></item><item><title>Analyzing the Dynamic Data 4.0 Preview</title><link>http://blogs.msdn.com/morebits/archive/2009/01/10/analyzing-the-dynamic-data-4-0-preview.aspx</link><pubDate>Sat, 10 Jan 2009 03:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9303089</guid><dc:creator>morebits</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9303089.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9303089</wfw:commentRss><description>&lt;h1&gt;Introduction&lt;/h1&gt;  &lt;p&gt;&lt;strong&gt;What&lt;/strong&gt;: Create your own project, called &lt;em&gt;DynamicDataProject, &lt;/em&gt;that mimics the &lt;em&gt;SampleProject&lt;/em&gt; shipped with ASP.NET &lt;a href="http://www.codeplex.com/aspnet/Wiki/View.aspx?title=Dynamic%20Data&amp;amp;referringTitle=Home" target="_blank"&gt;Dynamic Data 4.0 Preview&lt;/a&gt; available on &lt;em&gt;CodePlex&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Why&lt;/strong&gt;: The objective is to analyze the new Dynamic Data features and build gradually complex samples that exercise those features. In the process I will highlight the main elements that you must know to understand the new features. At least that's what I hope to accomplish. You will be the judges.&lt;/p&gt;  &lt;p&gt;Our software engineers did an excellent job in creating a set of projects to show the new Dynamic Data 4.0 features. For my own education, I decided to start from scratch by recreating these projects and adding my own examples that I will share in subsequent posts. Because I found this exercise very helpful, I decided to start sharing this information with you as I progress.&lt;/p&gt;  &lt;h1&gt;Overview&lt;/h1&gt;  &lt;p&gt;The &lt;a href="http://www.codeplex.com/aspnet/Wiki/View.aspx?title=Dynamic%20Data&amp;amp;referringTitle=Home" target="_blank"&gt;Dynamic Data 4.0 Preview&lt;/a&gt; contains Web projects that illustrate the next generation of Dynamic Data features including: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A Web site that uses scaffolding and interacts with the database using both Linq to Sql and Entity Framework models. &lt;/li&gt;    &lt;li&gt;A new Dynamic Data filter model that enables the developers to apply templates to pages just like field templates, including custom filters. This model will be supported by a new &lt;em&gt;QueryExtender&lt;/em&gt; control that simplifies common data filtering operations. This control provides a rich ASP.NET declarative query syntax that makes it easy to do things like search data for text or have filters based on ranges. &lt;/li&gt;    &lt;li&gt;Support for Database constructs such as inheritance for Entity Framework and Linq to SQL; many to many relationships in Entity Framework. &lt;/li&gt;    &lt;li&gt;New Entity Templates which allow finer control over how an object is displayed and edited. &lt;/li&gt;    &lt;li&gt;&lt;/li&gt;    &lt;li&gt;Attributes for controlling the filters appearance and order. &lt;/li&gt;    &lt;li&gt;A BusinessLogicDataSource control that uses a data provider model which enables the developers to build their own custom business logic. &lt;/li&gt;    &lt;li&gt;A datasource control for ADO.NET Data Services that works with ASP.NET and an ADO.NET Data Service Provider for Dynamic Data. &lt;/li&gt; &lt;/ul&gt;  &lt;hr /&gt;  &lt;h1&gt;DynamicDataProject &lt;/h1&gt;  &lt;p&gt;As I said before, I am going to build the &lt;em&gt;DynamicDataProject&lt;/em&gt; from the ground up. I will then use it to host my own examples. The project will show the use of the following features:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A Web site that uses scaffolding and interacts with the database using both Linq to Sql and Entity Framework models. &lt;/li&gt;    &lt;li&gt;A new Dynamic Data filter model that enables the developers to apply templates to pages just like field templates, including custom filters. This model will be supported by a new &lt;em&gt;QueryExtender&lt;/em&gt; control that simplifies common data filtering operations. This control provides a rich ASP.NET declarative query syntax that makes it easy to do things like search data for text or have filters based on ranges. &lt;/li&gt;    &lt;li&gt;Support for Database constructs such as inheritance for Entity Framework and Linq to SQL; many to many relationships in Entity Framework. &lt;/li&gt;    &lt;li&gt;New Entity Templates which allow finer control over how an object is displayed and edited. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The following is the project file organization:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/AnalyzingtheDynamicData4.0Preview_D824/dynamicdataproject_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" alt="dynamicdataproject" src="http://blogs.msdn.com/blogfiles/morebits/WindowsLiveWriter/AnalyzingtheDynamicData4.0Preview_D824/dynamicdataproject_thumb.jpg" width="207" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h2&gt;Create the DynamicDataProject&lt;/h2&gt;  &lt;p&gt;The following are the steps to create the project.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;In Visual Studio create a new project. &lt;/li&gt;    &lt;li&gt;Select Web as the project type. &lt;/li&gt;    &lt;li&gt;Select the &lt;i&gt;Dynamic Data Web Application&lt;/i&gt; template. &lt;/li&gt;    &lt;li&gt;In the Name box enter &lt;i&gt;DynamicDataProject&lt;/i&gt;. &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Reference the new Dynamic Data Assemblies&lt;/h2&gt;  &lt;p&gt;To use the new Dynamic Data features you must access the assemblies containing the new types which are not part of the product yet. Enabling the use of these types is achieved by adding the new DLLs to the project and modifying the Web.config file as shown next.&lt;/p&gt;  &lt;h3&gt;&lt;em&gt;Adding DLLs Referemce&lt;/em&gt;&lt;/h3&gt;  &lt;p&gt;The following are the steps you must perform.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Download &lt;a href="http://www.codeplex.com/aspnet/Wiki/View.aspx?title=Dynamic%20Data&amp;amp;referringTitle=Home" target="_blank"&gt;Dynamic Data 4.0 Preview&lt;/a&gt; from &lt;em&gt;Codeplex&lt;/em&gt;. &lt;/li&gt;    &lt;li&gt;Install the downloaded software. &lt;/li&gt;    &lt;li&gt;From the bin folder in the &lt;i&gt;SampleProject&lt;/i&gt; copy the following DLLs into the bin folder of your &lt;i&gt;DynamicDataProject&lt;/i&gt; project:       &lt;ul&gt;       &lt;li&gt;Microsoft.Web.Extensions.dll &lt;/li&gt;        &lt;li&gt;System.ComponentModel.DataAnnotations.dll &lt;/li&gt;        &lt;li&gt;System.Web.DynamicData.dll &lt;/li&gt;        &lt;li&gt;AjaxControlToolkit.dll &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;In the Solution Explorer of the &lt;i&gt;DynamicDataProject&lt;/i&gt; project right click on the &lt;i&gt;References&lt;/i&gt; folder and select &lt;strong&gt;Add Reference.&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;Select the Browse tab and navigate to the &lt;i&gt;DynamicDataProject&lt;/i&gt; bin folder. &lt;/li&gt;    &lt;li&gt;Add the DLLs. Remember to remove the old version of the DLLs first. &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;em&gt;Modify Web.config File&lt;/em&gt;&lt;em&gt;&lt;/em&gt;&lt;/h3&gt;  &lt;p&gt;The following are the steps you must perform. If you have issues, look at the &lt;em&gt;web.config&lt;/em&gt; file in the downloaded &lt;em&gt;SampleProject&lt;/em&gt;.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Add the &lt;i&gt;System.Data.Entity&lt;/i&gt; entry to the &lt;i&gt;&amp;lt;assembly&amp;gt;&lt;/i&gt; element. &lt;/li&gt;    &lt;li&gt;In the &lt;i&gt;&amp;lt;controls&amp;gt;&lt;/i&gt; element change the previously added DLLs' version number to 99.0.0.0. Also add the &lt;i&gt;AjaxControlToolkit&lt;/i&gt; entry to define the &lt;i&gt;ajaxToolkit&lt;/i&gt; tag prefix. &lt;/li&gt;    &lt;li&gt;In the &lt;i&gt;&amp;lt;dependentAssembly&amp;gt;&lt;/i&gt; element, add the &lt;i&gt;System.ComponentModel.DataAnnotations&lt;/i&gt; and &lt;i&gt;System.Web.DynamicData&lt;/i&gt;. This is to allow binding redirect from the older to the 99.0.0.0 DLL&amp;#8217;s version. &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Add the Database and Create Related Models&lt;/h2&gt;  &lt;p&gt;The database is a key element in a Dynamic Data Web site. The following steps describe how to add the Northwind database to your site. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Copy the Northwind.mdf file from the downloaded project to the&lt;i&gt; DynamicDataProject&lt;/i&gt; App_Data folder. &lt;/li&gt;    &lt;li&gt;Add the database models. The models contain the classes that are mapped to Nowthwind relational objects that enable Dynamic Data to access the underlying database. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For more information on this topic, see&amp;#160; &lt;a href="http://msdn.microsoft.com/en-us/library/cc488469.aspx"&gt;Walkthrough: Creating a New ASP.NET Dynamic Data Web Site Using Scaffolding&lt;/a&gt;.&lt;/p&gt;  &lt;h5&gt;&amp;#160;&lt;/h5&gt;  &lt;h2&gt;Modify Global.asax&lt;/h2&gt;  &lt;p&gt;You must modify the &lt;i&gt;Global.asax&lt;/i&gt; file to allow the use of multiple modelsby copying over the changes from the &lt;i&gt;SampleProject/Global.asax&lt;/i&gt;. For more information, see David&amp;#8217;s post &lt;a href="http://blogs.msdn.com/davidebb/archive/2008/12/11/using-dynamic-data-with-multiple-databases.aspx"&gt;Using Dynamic Data with multiple databases&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Notice the following:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The &lt;i&gt;RegisterRoutes&lt;/i&gt; method has been modified to allow registration of data context for both LinqToSQL and Entity Framework. It calls the &lt;i&gt;RegisterModelRoutes&lt;/i&gt; to initialize page templates routing accordingly. &lt;/li&gt;    &lt;li&gt;The &lt;i&gt;RegisterModelRoutes&lt;/i&gt; method has been modified to use the flag &lt;i&gt;useSeperatePages&lt;/i&gt; to select one of the following page display modes:       &lt;ul&gt;       &lt;li&gt;Combined-page mode, where the List, Detail, Insert, and Update tasks are performed by using the same page. &lt;/li&gt;        &lt;li&gt;Separate-page mode, where the List, Detail, Insert, and Update tasks are performed by using separate pages. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Modify the DynamicData Folder&lt;/h2&gt;  &lt;p&gt;The &lt;i&gt;DynamicData&lt;/i&gt; folder created by Visual Studio when you selected the &lt;em&gt;Dynamic Data Web Application&lt;/em&gt; template contains elements that are no longer valid. Keep the &lt;em&gt;Images&lt;/em&gt; folder, the &lt;em&gt;FilterUserControl.a&lt;/em&gt;scx and &lt;em&gt;GridViewPager.ascx&lt;/em&gt; controls. Delete all the other folders. &lt;/p&gt;  &lt;h2&gt;Modify Project Root Directory&lt;/h2&gt;  &lt;p&gt;You must modify the project root directory as described next.&lt;/p&gt;  &lt;h3&gt;&lt;em&gt;Copy Infrastructure Elements&lt;/em&gt;&lt;/h3&gt;  &lt;p&gt;Copy the following files from the downloaded &lt;em&gt;SampleProject&lt;/em&gt;:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;i&gt;Default.aspx&lt;/i&gt;. This file has been modified to display both models. &lt;/li&gt;    &lt;li&gt;&lt;i&gt;Site&lt;/i&gt;.css. It contains the styles used by the site. &lt;/li&gt;    &lt;li&gt;&lt;i&gt;Site&lt;/i&gt;.master. It contains the master page used by the site. &lt;/li&gt;    &lt;li&gt;&lt;i&gt;AutocompleteFilter.asmx&lt;/i&gt;. This service is needed by the &lt;i&gt;Autocomplete.ascx&lt;/i&gt; filter. &lt;/li&gt;    &lt;li&gt;&lt;i&gt;AutocompleteStyle.css&lt;/i&gt;. It contains the styles used during auto complete. &lt;/li&gt;    &lt;li&gt;&lt;i&gt;AjaxToolKit&lt;/i&gt;.css. It contains the styles used by the Ajax toolkit controls. &lt;/li&gt;    &lt;li&gt;&lt;i&gt;NorthwindPartials&lt;/i&gt;.cs. It contains the partial classes that enable you to apply custom metadata information. &lt;/li&gt;    &lt;li&gt;&lt;i&gt;DynamicDataL2S &lt;/i&gt;folder. Copy the &lt;i&gt;SampleProject/DynamicDataL2S&lt;/i&gt; folder to your Web site root directory. The &lt;em&gt;DynamicDataL2S&lt;/em&gt; folder contains the templates needed by Dynamic Data to function. It also contains the new entity templates and filters in the related folders. The &lt;i&gt;DynamicDataL2S&lt;/i&gt; elements apply to the Linq to Sql model. &lt;/li&gt;    &lt;li&gt;&lt;i&gt;DynamicDataEF &lt;/i&gt;folder. Copy the &lt;i&gt;SampleProject/DynamicDataEF&lt;/i&gt; folder to your Web site root directory. This folder contains the templates needed by Dynamic Data to function. It also contains the new entity templates folder. The &lt;i&gt;DynamicDataEF&lt;/i&gt; elements apply to the Entity Framework model. &lt;/li&gt; &lt;/ul&gt;  &lt;h5&gt;&lt;em&gt;Copy Samples &lt;/em&gt;&lt;/h5&gt;  &lt;p&gt;Copy the following sample folders from the downloaded &lt;em&gt;SampleProject:&lt;/em&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;i&gt;EntityTemplateSamples&lt;/i&gt; folder. Copy the &lt;i&gt;SampleProject/ EntityTemplateSamples&lt;/i&gt; folder to your Web site root directory. This folder contains the pages/samples that show how to use the templates. &lt;/li&gt;    &lt;li&gt;&lt;i&gt;FitlerSamples &lt;/i&gt;folder. Copy the &lt;i&gt;SampleProject/ FitlerSamples &lt;/i&gt;folder to your Web site root directory. This folder contains samples showing how to use the filters. &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Add MySamples Folder&lt;/h2&gt;  &lt;p&gt;This folder contains my examples that exercise the new Dynamic Data features. Refer to these related posts: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/morebits/archive/2009/01/30/querying-dynamic-data-table-by-a-data-key.aspx"&gt;Querying a Table By a Foreign Key in Dynamic Data&lt;/a&gt;. This post shows how to query a child table using a column from a parent table. A simpler example of this would be if the column belongs to the same table. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts&amp;amp;sectionid=11743&amp;amp;postid=9303235"&gt;Querying a Table By a Foreign Key using Dynamic Data Filtering&lt;/a&gt;. This post shows how to query a child table using a column from a parent table in dynamic data filtering.&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/morebits/archive/2009/01/13/common-steps-to-apply-a-filter-template-to-a-data-field.aspx"&gt;Querying a Table By a Column using Dynamic Data Filtering&lt;/a&gt;. This post shows how to query a table using a column value in dynamic data filtering. &lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9303089" width="1" height="1"&gt;</description></item><item><title>Welcome </title><link>http://blogs.msdn.com/morebits/archive/2009/01/07/welcome.aspx</link><pubDate>Wed, 07 Jan 2009 20:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9288768</guid><dc:creator>morebits</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/morebits/comments/9288768.aspx</comments><wfw:commentRss>http://blogs.msdn.com/morebits/commentrss.aspx?PostID=9288768</wfw:commentRss><description>Welcome to my "technical notes" blog. &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9288768" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/morebits/archive/tags/Greetings/default.aspx">Greetings</category></item></channel></rss>