Basic Usage of MultiView and View Controls in ASP.NET - Design time properties of View Control
(Page 3 of 5 )
While the ID and runat attributes are added by default, you could access other properties and invoke events of the View control as shown in the next picture.

The run time properties and methods of View1 can be accessed from the code page as shown. It may be noticed that there is no style property for a view. The controls' style, or style applied from skins, may be used.

In the following design view of the web page, you may use one of several ways to make View1 display when the page is browsed.

You may use the Form_Load() event to make View1 display using either of the following statements. The one that is commented out displays the required View as an argument, whereas the other uses the ActiveViewIndex property, which refers to the 0 based index property of collection of the Views in the MultiView container.
Protected Sub form1_Load(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles form1.Load 'MultiView1.SetActiveView(View1)
MultiView1.ActiveViewIndex = 0
End Sub
It is also possible and sometimes important to script this action in the script together with the source code by adding the following to the source code between the <head/> <script/> sections. In this code the .vb page is devoid of any code.
<script type="text/vbscript" runat="server"> Protected Overloads Sub
form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles form1.Load
MultiView1.SetActiveView(View1)
'MultiView1.ActiveViewIndex = 0
End Sub </script>
Yet another way of making View1 visible is to declaratively make it display in the attribute tag of the MultiView Control, as shown in a later example.
Next: Container Properties of View and MultiView Controls >>
More .NET Articles
More By Jayaram Krishnaswamy