| New Web Server Controls in ASP.Net 2.0 |
| |
| View and MultiView Web Server Control |
| |
| The MultiView and View controls are new addition to ASP.NET 2.0. The MultiView and View control are very similar to the Tab Control in ASP.NET. The MultiView control acts as an external container for one or more View controls and a View control works as a container of common controls. |
| |
| The View control is act as a container for a collection of controls. A View control must always be contained within a MultiView control. Only one View control at a time can be defined as the active view within a MultiView control. |
| |
| The MultiView control presents one View control at a time, exposing the markup and controls within that View control. You can specify which View control is currently visible by setting the MultiView control's ActiveViewIndex property. |
| |
| MultiView control and View control does not render any markup to the page other than the contents of the current View control. |
| |
| You can navigate between views by setting the MultiView control's ActiveViewIndex property to the index value of the View control to display. The MultiView control also includes support for navigation buttons that you can add to each View control. |
| |
| You can add a button control like Button, LinkButton, or ImageButton to each View control to create navigation buttons and after that set the CommandName and CommandArgument properties of each button to reserved values to cause the MultiView control to move to another view. The list of the reserved CommandName values and the corresponding CommandArgument values are given following table. |
| |
| Command Name value |
Command Argument value |
| NextView |
(no value) |
| PrevView |
(no value) |
| SwitchViewByID |
ID of the View control for switch to. |
| SwitchViewByIndex |
Index number of the View control for switch to. |
|
| |
Syntax:
<asp:MultiView ID="MyMultiView" runat="server" ActiveViewIndex="0">
<asp:View ID="ViewA" runat="server"> View A<br /> <br />
<asp:Button ID="ButtonA" runat="server"
CommandArgument="ViewB"
CommandName="SwitchViewByID"
Text="Go to ViewB" />
</asp:View>
<asp:View ID="ViewB" runat="server"> View B <br />
<asp:Button ID="ButtonB" runat="server"
CommandArgument="ViewC"
CommandName="SwitchViewByID"
Text="Go to View C" />
</asp:View>
<asp:View ID="ViewC" runat="server"> View C<br /> <br />
<asp:Button ID="ButtonC" runat="server"
CommandArgument="ViewA"
CommandName="SwitchViewByID"
Text="Go to View A" />
</asp:View>
</asp:MultiView> |
| |
|
| |