stuactivityinfo.aspx.cs

来自「一个研究生管理系统 具体的情况自己看了」· CS 代码 · 共 88 行

CS
88
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;

public partial class student_stuactivityinfo : System.Web.UI.Page
{
    public int allpage = 10;
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["Student"].ToString()!= "true")
            {
                Response.Write("<script>parent.window.href=\"../login.aspx\"</script>");
                Response.End();
            }
        }
        catch
        {
            Response.Write("<script>parent.window.href=\"../login.aspx\"</script>");
            Response.End();
        }
        if (!IsPostBack)
        {

            DataTable reader = Student.Student.GetActivityInfo();
            if (reader != null)
                allpage = reader.Rows.Count;
            else allpage = 0;
        }
    }
    public void PrintReport()
    {
        int pageid = 0;
        try
        {
            pageid = Convert.ToInt32(Request["pageid"]);

        }
        catch (Exception ex)
        {
            pageid =0;
            Response.Write(ex.Message);

        }
        try
        {
            DataTable reader = Student.Student.GetActivityInfo();
            if (reader != null)
            {
               
                for (int i = pageid * 10, j = 0; i < reader.Rows.Count && j < 10; i++, j++)
                {
                    Response.Write("<tr>");
                    Response.Write("<td width=\"20%\" align=right class=mode4 style=\"height: 23px\">学生活动:</td>");
                    Response.Write("<td width=\"72%\" align=left class=mode5 style=\"height: 23px\"><div align=\"center\">" + reader.Rows[i]["ActivityName"].ToString() + "</div></td>");
                    Response.Write("<td width=\"8%\" align=left class=mode5 style=\"height: 23px\"><div align=\"center\"><a href=\"#\" OnClick=\"showModalDialog('activitydetailinfo.aspx?activityid=" + reader.Rows[i]["ActivityID"].ToString() + "',' ','dialogHeight:490px;dialogWidth:650px')\">查看</a></div></td>");
                    Response.Write("</tr>");

                }
                page_1.Text = "当前是第" + pageid.ToString() + "页";
                allpage = reader.Rows.Count / 10 + 1;
                page_all.Text = "共" + Convert.ToString(allpage) + "页";
            }


        }
        catch (Exception ex)
        {
            Response.Write("<script> alert(\'" + ex.Message + "\')</script>");
        }
    }
    public void PrintPage()
    {
        for (int i = 0; i < allpage; i++)
        {
            Response.Write("<a href=stuactivityinfo.aspx?pageid=" + i.ToString() + ">" + i.ToString() + "&nbsp</a>\n");
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?