跪求 asp.net 学生信息管理系统 主页面代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>学生信息管理系统</title>
</head>
<body>
<form id="form1" runat="server">
<div><center style="background-color: #008000">
<h2>欢迎学生信息系统</h2>
<p> </p>
<asp:Button ID="Button1" runat="server" Height="35px" onclick="Button1_Click"
PostBackUrl="~/z.aspx" Text=" 添加学生信息" Width="108px" />
<br />
<br />
<asp:Button ID="Button5" runat="server" Height="37px" onclick="Button5_Click"
Text="删除学生信息" Width="104px" />
<br />
<br />
<asp:Button ID="Button6" runat="server" Height="39px" onclick="Button6_Click"
Text="查询学生信息" Width="102px" />
<br />
<br />
<asp:Button ID="Button7" runat="server" Height="41px" onclick="Button7_Click"
Text="修改学生信息" Width="103px" />
<br />
<br />
<p> </p>
</center>
</div>
</form>
</body>
</html>
这是按钮的触发事件代码,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("~/z.aspx");
}
protected void Button5_Click(object sender, EventArgs e)
{
Response.Redirect("~/s.aspx");
}
protected void Button6_Click(object sender, EventArgs e)
{
Response.Redirect("~/c.aspx");
}
protected void Button7_Click(object sender, EventArgs e)
{
Response.Redirect("~/g.aspx");
}
}
你自己要在那文件新建z.aspx,s.aspx,c.aspx,g.aspx,还有在按钮的事件属性里PostbackUrl里分别加上z.aspx,s.aspx,c.aspx,g.aspx地址就OK!
2024-08-07 广告