ASP.NET Tutorial/ASP.net Controls/View — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 15:00, 26 мая 2010

Using the MultiView and View server controls (C#)

   <source lang="csharp">

<%@ Page Language="C#"%> <script runat="server">

   protected void Page_Load(object sender, EventArgs e)
   {
       if (!Page.IsPostBack)
       {
           MultiView1.ActiveViewIndex = 0;
       }
   }
   void NextView(object sender, EventArgs e)
   {
       MultiView1.ActiveViewIndex += 1;
   }

</script> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server">

   <title>MultiView Server Control</title>

</head> <body>

   <form id="form1" runat="server">
       <asp:MultiView ID="MultiView1" Runat="server">
           <asp:View ID="View1" Runat="Server">
               A<p />
               asdf<p />
               <asp:Button ID="Button1" Runat="Server" Text="Next Step" 
                OnClick="NextView" />
           </asp:View>
           <asp:View ID="View2" Runat="Server">
               B<p />
               sdfg.<p />
               <asp:Button ID="Button2" Runat="Server" Text="Next Step" 
                OnClick="NextView" />
           </asp:View>
           <asp:View ID="View3" Runat="Server">
               C<p />
               dfgh
<p /> </asp:View> </asp:MultiView> </form>

</body> </html></source>


Using the MultiView and View server controls (VB)

   <source lang="csharp">

<%@ Page Language="VB"%> <script runat="server">

   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
       If Not Page.IsPostBack Then
           MultiView1.ActiveViewIndex = 0
       End If
   End Sub
   
   Sub NextView(ByVal sender As Object, ByVal e As System.EventArgs)
       MultiView1.ActiveViewIndex += 1
   End Sub

</script> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server">

   <title>MultiView Server Control</title>

</head> <body>

   <form id="form1" runat="server">
       <asp:MultiView ID="MultiView1" Runat="server">
           <asp:View ID="View1" Runat="Server">
               A<p />
               asdf<p />
               <asp:Button ID="Button1" Runat="Server" Text="Next Step" 
                OnClick="NextView" />
           </asp:View>
           <asp:View ID="View2" Runat="Server">
               B<p />
               sdfg.<p />
               <asp:Button ID="Button2" Runat="Server" Text="Next Step" 
                OnClick="NextView" />
           </asp:View>
           <asp:View ID="View3" Runat="Server">
               C<p />
               dfgh
<p /> </asp:View> </asp:MultiView> </form>

</body> </html></source>