ASP.Net/Components/PageView MultiPage

Материал из .Net Framework эксперт
Версия от 11:51, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Adding a PageView Control to a MultiPage Control (VB.net)

<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="IEControls" 
    Namespace="Microsoft.Web.UI.WebControls" 
    Assembly ="Microsoft.Web.UI.WebControls"
%>
<HTML>
<HEAD>
<TITLE>Adding a PageView Control to a MultiPage Control</TITLE>
</HEAD>
<BODY LEFTMARGIN="40">
<form runat="server">
<IEControls:multipage 
    id="MyMultiPage"
    runat="server"
    borderstyle=9
    borderwidth=3
    bordercolor="DarkBlue"
    width="90%"
    height="50%"
    >
    <IEControls:PageView
        id="pv1"
        runat=server
        font-name="Arial"
        font-bold=True
        forecolor="yellow"
        backcolor="darkred"
    >
        Enter your name:<BR>
        <asp:textbox 
        id="txtName" 
        runat=server 
        />    
        <BR>
        Enter your password:<BR>
        <asp:textbox 
        id="txtPassword" 
        runat=server 
        />    
        <BR>
    </IEControls:PageView>    
</IEControls:multipage>
</form>
</BODY>
</HTML>



Adding Controls to a PageView Control in Code (VB.net)

<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="IEControls" 
    Namespace="Microsoft.Web.UI.WebControls" 
    Assembly ="Microsoft.Web.UI.WebControls"
%>
<script runat=server>
Sub OK_Click(Sender As Object, E As EventArgs)
    Dim I as Integer
    For I = 1 to txtNumber.Text
        Dim MyTextBox = New TextBox
        MyTextBox.ID = "txtDynamic" & I
        MyTextBox.Text = "Control Number: " & I
        pv2.Controls.Add(MyTextBox)
    Next
    MyMultiPage.SelectedIndex = 1
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Adding Controls to a PageView Control in Code</TITLE>
</HEAD>
<BODY LEFTMARGIN="40">
<form runat="server">
<IEControls:multipage 
    id="MyMultiPage"
    runat="server"
    >
    <IEControls:PageView
        id="pv1"
        runat=server
    >
        How many TextBox controls do you want?<BR>
        <asp:textbox 
        id="txtNumber" 
        runat=server 
        />    
        <BR>
        <asp:button 
        id="butOK"
        text="  OK  "
        onclick="OK_Click" 
        runat="server"
        />
    </IEControls:PageView>    
    <IEControls:PageView
        id="pv2"
        runat=server
    >
    </IEControls:PageView>    
</IEControls:multipage>
</form>
</BODY>
</HTML>



Creating a Basic MultiPage Control (VB.net)

<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="IEControls" 
    Namespace="Microsoft.Web.UI.WebControls" 
    Assembly ="Microsoft.Web.UI.WebControls"
%>
<HTML>
<HEAD>
<TITLE>Creating a Basic MultiPage Control</TITLE>
</HEAD>
<BODY LEFTMARGIN="40">
<form runat="server">
<IEControls:multipage 
    id="MyMultiPage"
    runat="server"
    borderstyle=9
    borderwidth=3
    bordercolor="DarkBlue"
    width="90%"
    height="50%"
    >
</IEControls:multipage>
</form>
</BODY>
</HTML>



IEControl: multipage test (C#)

<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %>
<%@ Page language="c#" src="MultiPageTest.aspx.cs" AutoEventWireup="false" Inherits="MultiPageTest" %>
<HTML>
  <body>
    <form id="Form1" method="post" runat="server">
      <P>
        <iewc:MultiPage id="MultiPage1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 36px" runat="server" Width="301px" Height="272px" BorderStyle="Outset" BorderWidth="1px">
          <iewc:PageView id="page1">
            <br>
            <h3>&nbsp;This is Page 1</h3>
          </iewc:PageView>
          <iewc:PageView id="page2">
            <br>
            <h3>&nbsp;This is Page 2</h3>
          </iewc:PageView>
          <iewc:PageView id="page3">
            <br>
            <h3>&nbsp;This is Page 3</h3>
          </iewc:PageView>
        </iewc:MultiPage></P>
      <P>
        <iewc:TabStrip id="TabStrip1" runat="server" TargetID="MultiPage1" Width="300px">
          <iewc:Tab Text="Tab 1"></iewc:Tab>
          <iewc:Tab Text="Tab 2"></iewc:Tab>
          <iewc:Tab Text="Tab 3"></iewc:Tab>
        </iewc:TabStrip></P>
      <P>
      </P>
    </form>
  </body>
</HTML>
<%--
using System;
using System.Collections;
using System.ruponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
  public class MultiPageTest : System.Web.UI.Page
  {
    protected Microsoft.Web.UI.WebControls.MultiPage MultiPage1;
    protected Microsoft.Web.UI.WebControls.TabStrip TabStrip1;
  
    private void Page_Load(object sender, System.EventArgs e)
    {
    }
    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
      InitializeComponent();
      base.OnInit(e);
    }
    
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {    
      this.Load += new System.EventHandler(this.Page_Load);
    }
    #endregion
  }

--%>



IE Controls:multipage: use combobox to control page index (VB.net)

<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="IEControls" 
    Namespace="Microsoft.Web.UI.WebControls" 
    Assembly ="Microsoft.Web.UI.WebControls"
%>
<script runat=server>
Sub ddl1_Changed(Sender As Object, E As EventArgs)
    MyMultiPage.SelectedIndex = ddl1.SelectedItem.Value
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Providing Navigation in a MultiPage Control Using a DropDownList</TITLE>
</HEAD>
<BODY LEFTMARGIN="40">
<form runat="server">
<IEControls:multipage 
    id="MyMultiPage"
    runat="server"
    selectedindex=0
    >
    <IEControls:PageView
        id="pv1"
        runat=server
        font-name="Arial"
        font-bold=True
        forecolor="yellow"
        backcolor="darkred"
    >
        Enter your name:<BR>
        <asp:textbox 
        id="txtName" 
        runat=server 
        />    
        <BR>
    </IEControls:PageView>    
    <IEControls:PageView
        id="pv2"
        runat=server
        font-name="Arial"
        font-bold=True
        forecolor="darkred"
        backcolor="yellow"
    >
        Enter your email address:<BR>
        <asp:textbox 
        id="txtEmail" 
        runat=server 
        />    
    </IEControls:PageView>    
    <IEControls:PageView
        id="pv3"
        runat=server
        font-name="Arial"
        font-bold=True
        forecolor="darkblue"
        backcolor="green"
    >
        Enter your password:<BR>
        <asp:textbox 
        id="txtPassword" 
        runat=server 
        />    
    </IEControls:PageView>    
</IEControls:multipage>
<BR><BR>
<asp:dropdownlist
    id="ddl1"
    autopostback="True"
    onselectedindexchanged="ddl1_Changed"
    runat="server"
>
    <asp:listitem value="0">Name</asp:listitem>
    <asp:listitem value="1">Email</asp:listitem>
    <asp:listitem value="2">Password</asp:listitem>
</asp:dropdownlist>
</form>
</BODY>
</HTML>