不过我参考一下你的代码,,最终还得自己来完成,感激不尽;
继续向前-------------------努力成为高手
<%@ Page Language="C#"%>
<script language="c#" runat="server">
void WriteInfo(object serder, EventArgs e)
{ string[] strtemp = new string[5] { "<br/>", "<br/>", "<br/>", "<br/>", "<br/>" };
int i = 1;
strtemp[i] = "姓名:"+name.Text+"<br/>" + "<br/>";
if(ra1.Checked )strtemp[i]+="性别:"+"男";
else strtemp[i]+="性别:"+"女";
strtemp[i] += "生日:" + birthday.Text + "<br/>" + "学号:" + sno.Text + "email:" + email.Text+"<br/>" ;
strtemp[i] += "民族:";
strtemp[i] += content.Text.Replace(Convert.ToString(Convert.ToChar(13)), "<br>");
i++;
}
void putout(object serder, EventArgs e)
{ if (i == 5)
{
labContent1.Text = strtemp[i];
}
else
{ labContent1.Text = "请输入五个后再提交,否则重启程序"; }
}
}
</script>
<html>
<body >
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size:18px" >
<tr>
<td>5.编写程序,让用户输入五个学生的姓名,年龄,住址,等信息,在提交后一起显示.</td>
</tr>
</table>
<hr style="color:Green"/>
<form runat="server" enctype="multipart/form-data">
<table style="width:700;font:14px;" border="0" cellpadding="0" cellspacing="0" / >
<tr style="background-color:#B5E1FF">
<td colspan ="2" style="font-size:16px;">个人资料</td>
</tr>
<tr>
<td >姓名<asp:TextBox runat="server" ID="name" MaxLength="40" /></td>
</tr>
<tr>
<td style="width:50%">性别<asp:radiobutton ID="ra1" runat="server" GroupName ="rg" Text="男" Checked="true" />
<asp:radiobutton ID="ra2" runat="server" GroupName ="rg" Text="女" Checked="false" /></td>
<td style ="width:50%">生日 <asp:TextBox runat ="server" ID="birthday" MaxLength ="10"/>(如:1986-05-05)</td>
</tr>
<tr><td style="width:50%">学号<asp:textbox ID="sno" runat="server" /></td>
<td style="width:50%">E-mail<asp:textbox runat="server" ID="email"/></td>
</tr>
<tr><td style="width:50%">民族<select id="nation" runat="server" ><option value="1">汉族</option><option value ="2">回族</option><option value="3">苗族</option><option value="4">藏族</option><option value="5"> 其他民族</option></select></td>
<td style="width:50%">你的职业<select><option>信息软件业</option><option>信息硬件业</option><option>其他行业</option></select></td>
</tr>
<tr> <td colspan="2">地址<asp:TextBox runat="server" ID="address" /></td>
</tr>
<tr>
<td> <asp:TextBox runat="server" ID="content" Columns="20" Rows="4" TextMode="multiline" Wrap="true" /><br />
<input type="button" runat="server" id="nextname" value="下一个" onserverclick="WriteInfo" /> <br />
<asp:Button runat="server" ID="lnksubmi" Text="提交" OnClick="WriteInfo" /><br /><br />
<asp:Label runat="server" ID="labContent1" /><br />
</td>
</tr>
</table>
</form>
</body>
</html>
[此贴子已经被作者于2007-3-26 19:05:55编辑过]
代码如下:
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<html>
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="Form_Post" runat="server">
<h4><asp:Label id="Write_Number" runat="Server"/></h4>
姓名:<asp:TextBox id="Write_Name" runat="server"/>
<br/>
地址:<asp:TextBox id="Write_ADD" runat="server"/>
<asp:Button id="Write_Button" Text="提交" OnClick="Write_Button_Post" runat="server"/>
<br><br>
<h4>您所提交的信息如下</h4>
<asp:Label id="Write_Label" runat="Server"/>
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
public static string[] i={"",""};
public static int j=0;
public static string r="";
protected void Page_Load(object sender, EventArgs e)
{
if (j<2)
{
Write_Number.Text="您好,你必需提交2个人的数据,你目前已经提交了"+Convert.ToString(j)+"人";
}
else
{
Write_Number.Text="您好,你已经提交了2个人的数据,提交完成!";
}
}
protected void Write_Button_Post(object sender, EventArgs e)
{
if (j<2)
{
i[j]="姓名:"+Write_Name.Text+"<br/>"+Write_ADD.Text;
r+=i[j]+"<br/><br/>";
j++;
}
else
{
Write_Label.Text=r;
j=0;
r="";
for (int t=2;t<2 ;t++)
{
i[t]="";
}
}
}
}
现在看你这个贴子,
protected void Page_Load(object sender, EventArgs e)
{
if (j<2)
{
Write_Number.Text="您好,你必需提交2个人的数据,你目前已经提交了"+Convert.ToString(j)+"人";
}
else
{
Write_Number.Text="您好,你已经提交了2个人的数据,提交完成!";
}
}
这个事件都没有被调用过,怎么运行时还是自己执行了呢