日期:2014-05-18 浏览次数:20484 次
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="test1.aspx.cs" Inherits="Pranser.test1" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <asp:ScriptManager ID="XML" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="Update1" runat="server"> <ContentTemplate> <asp:PlaceHolder ID="Place1" runat="server"> <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" OnTextChanged="TextBox1_TextChanged" ></asp:TextBox> </asp:PlaceHolder> </ContentTemplate> </asp:UpdatePanel> <asp:Button ID="Button1" OnClick="Button1_Click" runat="server" /> </asp:Content>
namespace Pranser { public partial class test1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void TextBox1_TextChanged(object sender, EventArgs e) { for (int i = 0; i < int.Parse(TextBox1.Text); i++) { TextBox tb = new TextBox(); tb.ID = "tb" + i.ToString(); Place1.Controls.Add(tb); } } protected void Button1_Click(object sender, EventArgs e) { Server.Transfer("test2.aspx"); } } }
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="test2.aspx.cs" Inherits="Pranser.test2" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <asp:Label ID="Label1" runat="server"></asp:Label> </asp:Content>
namespace Pranser { public partial class test2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } }