byhand_snytax.aspx.cs.svn-base

来自「大学英语学习系统」· SVN-BASE 代码 · 共 72 行

SVN-BASE
72
字号
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;
using System.Data.SqlClient;
public partial class AutoManage_ByHand_Snytax : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["USERSTYLE"] == "TEACHER")
        {
        }
        else
        {
            Dialog("对不起,你没有权限访问这个页面!");
            Response.Redirect("~/SystemManage/Login.aspx");
        }
    }
    private void Dialog(String Str)
    {
        Response.Write(@"<script type='text/JavaScript'>");
        Response.Write(@"alert('" + Str + "');");
        //Response.Write(@"window.location='./list_logingroup.aspx';");
        Response.Write(@"</script>");
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string id = "" + GridView1.DataKeys[GridView1.SelectedIndex].Values[0];
        string ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        SqlConnection myConnection = new SqlConnection(ConnectionString);
        string sql = "SELECT TSCONTENT FROM V_TESTSYNTAX WHERE TSNO='" + id + "'";
        SqlDataAdapter command = new SqlDataAdapter(sql, myConnection);
        myConnection.Open();
        DataSet mydataset = new DataSet();
        command.Fill(mydataset, "V_TESTSYNTAX");
        TextBox1.Text = mydataset.Tables[0].Rows[0][0].ToString();

        myConnection.Close();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int j = 0;
        string[] Yufath = new string[20];
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            bool isChecked = ((CheckBox)GridView1.Rows[i].FindControl("chkSelect")).Checked;
            if (isChecked)
            {
                j++;
                if (j > 20)
                {
                    Dialog("你最多只能选择20个题目!!");
                    return;
                }
                Yufath[j-1] = GridView1.Rows[i].Cells[1].Text;
            }
        }
        Session["Yufath"] = Yufath;
        Server.Transfer("Auto.aspx");
    }
    protected void BtnReturn_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/SystemManage/TeacherMain.aspx");
    }
}

⌨️ 快捷键说明

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