Controls You Can Use on Web Forms ASP.NET IE WebControls MultiView WebControl
MultiView controls can be nested, or used within another MultiView.
This is particularly useful when presenting subsets of pages within the main set of pages. This section briefly explores an example that includes the previous MultiView sample ( showing thumbnails and full images ), nested within another MultiView.
The below procedures show the minimum steps needed to display nested MultiView controls.
- Nesting MultiView elements is pretty straightforward, with markup taking the following form.
<ie:multiview id="multiview1" runat="server">
<ie:view id="view1">
... view1 content goes here ...
</ie:view>
<ie:view id="view2">
<ie:multiview id="multiview2" runat="server">
<ie:view id="subviewA">
... subviewA content goes here ...
</ie:view>
<ie:view id="subviewB">
... subviewB content goes here ...
</ie:view>
</ie:multiview>
</ie:view>
</ie:multiview>
- Next, add the interface to enable the user to navigate the main set of pages.
For this example, we use <asp:button
> controls.
<asp:button id="btnBack" runat="server" font-size=9pt
text="< Back" onclick="backClick" />
<asp:button id="btnNext" runat="server" font-size=9pt
text="Next >" onclick="nextClick" />
- Lastly, add code to handle the navigation.
Basically when either of the buttons is clicked in this example, the corresponding handler simply increments or decrements the ActiveViewIndex property of the MultiView.
public void nextClick ( object sender, EventArgs e ) {
if ( cityInfo.ActiveViewIndex < ( cityInfo.Controls.Count - 1 ) ) {
cityInfo.ActiveViewIndex ++;
setButtons ( );
}
}
public void backClick ( object sender, EventArgs e ) {
if ( cityInfo.ActiveViewIndex > 0 ) {
cityInfo.ActiveViewIndex --;
setButtons ( );
}
}
The links to the sections below illustrate further ways of implementing navigation within a MultiView control.
Using MultiView Controls in a Templated Control Navigating Views in the MultiView Control