You are developing a Web application that enables the administration and management of the existing Domain.com Web site. The Web application has a page named subcategories.aspx that makes use of WebParts. The code for the WebPart is shown in the following exhibit.
<asp:WebPartZone ID=”_webPartZone” Runat=”Server”> <ZoneTemplate>
<custom:CategoryWebPart ID=”_category” Runat=”Server” /> <custom:SubcategoryWebPart ID=”_subcat” Runat=”Server” /> </ZoneTemplate>
</asp:WebPartZone>
The CategoryWebPart control displays a list of product categories from the CKProducts database. The administrator can either select categories from a DropDownList or manually enter a category in a TextBox. The SubcategoryWebPart control displays the subcategories that belong to the category specified in the CategoryWebPart control. You modify the Web.config file to allow the SubcategoryWebPart control to use the category entered or selected in the CategoryWebPart control. You now need to add code to the subcategories.aspx page that connects the two WebPart controls every time the page is loaded.
What code segment should you use?
A.
<asp:WebPartManager ID=”_webPartManager” Runat=”Server”> <StaticConnections>
<asp:WebPartConnection ID=”_webPartCon” ProviderID=”_subcat” ConsumerID=”_category” />
</StaticConnections>
</asp:WebPartManager>
B.
<asp:WebPartManager ID=”_webPartManager” Runat=”Server”> <StaticConnections>
<asp:WebPartConnection ID=”_webPartCon” ProviderID=”_category” ConsumerID=”_subcat” />
</StaticConnections>
</asp:WebPartManager>
C.
<asp:ConnectionsZone ID=”_conZone” Runat=”Server”> <custom:CategoryWebPart ID=”_category” Runat=”Server” /> <custom:SubcategoryWebPart ID=”_subcat” Runat=”Server” /> </asp:ConnectionsZone>
D.
<asp:ConnectionsZone ID=”_categoryCon” Runat=”Server”> <custom:CategoryWebPart ID=”_category” Runat=”Server” /> </asp:ConnectionsZone>
<asp:ConnectionsZone ID=”_subcatCon” Runat=”Server”> <custom:SubcategoryWebPart ID=”_subcat” Runat=”Server” /> </asp:ConnectionsZone>
Explanation:
Seite 104 von 144
BRAINDUMPS – ASP.NETThe WebPartManager control is used to connect two WebPart controls. The provider WebPart control and the consumer WebPart control must be specified in the StaticConnections element of the WebPartManager control. In this instance, the provider is the _category WebPart control and the consumer is the _subcategory WebPart.
Incorrect Answers:
A: In this instance, the provider is the _category WebPart control and the consumer is the _subcategory WebPart.
C, D: The ConnectionsZones control allows users to configure connections between WebPart controls.