[求助]网页如何解决调用不相关代码的问题?
这是textbox中的代码 部分代码省略
protected void TextBox3_TextChanged(object sender, EventArgs e)
{
if (Convert.ToInt16(Label6.Text.ToString()) != -1)//判断某一学生是否被选中
{
Label8.Text = ((TextBox)GridView1.Rows[Convert.ToInt16(Label6.Text.ToString())].Cells[4].FindControl("TextBox3")).Text.ToString().Trim();//修改的课题志愿1
Label7.Text = GridView1.Rows[Convert.ToInt16(Label6.Text.ToString())].Cells[0].Text.ToString().Trim();//该学生学号
this.ktcx1 = this.NewLink.TempSelectData("by_hyxktcx @mc='" + Convert.ToString(Label8.Text) + "',@xh='" + Convert.ToString(Label7.Text) + "'");
if (ktcx1.Rows.Count < 1)
{
Response.Write("<script>alert(\"无相关毕业课题,请重新输入。支持模糊查询\")</script>");
((TextBox)GridView1.Rows[Convert.ToInt16(Label6.Text.ToString())].Cells[4].FindControl("TextBox3")).Focus();
}
else
{
if (Convert.ToInt16(Label1.Text) == 0)
{
this.Panel1.Visible = true; //出现选择课题 panel1
Label11.Text = Convert.ToString(3);
}
}
}
下面在panel1 里面选择了课题之后 确定按钮的事件
protected void Button5_Click(object sender, EventArgs e)
{
switch (Convert.ToInt16(Label11.Text))
{
case 3://更新第一志愿
this.NewLink.UpdataSQLCommandNonQuery("update jw_xsb set byktzy1=" + Convert.ToInt16(TextBox8.Text) + " where xh='" + this.Label7.Text.ToString().Trim() + "'");
Label11.Text = Convert.ToString(0);
TextBox7.Text = "";
TextBox8.Text = "";
Label8.Text = "";
Label7.Text = "";
Label6.Text = Convert.ToString(-1);
this.Panel1.Visible = false; break;
case 4://更新第二志愿
。。。。。
然后自动排课代码为
protected void Button1_Click(object sender, EventArgs e)
{
this.TextBox1.Text = Convert.ToString(122);
this.zyb = this.NewLink.TempSelectData("by_hyx_sjdq16 @zyfzr=" + int.Parse(this.TextBox1.Text.ToString().Trim()) + "");
GridView1.DataSource = zyb;//已经打乱的学生志愿表
GridView1.DataBind();
this.ktb = this.NewLink.TempSelectData("by_hyx_ktsj16 @zyfzr=" + int.Parse(this.TextBox1.Text.ToString().Trim()) + ""); //课题表
//第一志愿
for (int i = 0; i < zyb.Rows.Count; i++)
{
int zy1 = int.Parse(zyb.Rows[i]["志愿1"].ToString().Trim());
int zszy = int.Parse(zyb.Rows[i]["正式课题"].ToString().Trim());
if (zszy == 0)
{
DataView ktb1 = new DataView(ktb);
ktb1.RowFilter = "ktbh=" + zy1 + "";
int sfjs = ktb1.Count;
if (sfjs > 0)
{
DataTable ktb2 = ktb1.ToTable();
int zgrs = int.Parse(ktb2.Rows[0][3].ToString().Trim());
int sjrs = int.Parse(ktb2.Rows[0][4].ToString().Trim());
if (sjrs < zgrs)
{
for (int j = 0; j < ktb.Rows.Count; j++)
{
if (ktb.Rows[j]["ktbh"].ToString() == zy1.ToString())
{
ktb.Rows[j]["sjrs"] = sjrs + 1;
zyb.Rows[i]["正式课题"] = zy1;
zyb.Rows[i]["毕业指导教师"] = int.Parse(ktb.Rows[j]["jsbh"].ToString().Trim());
}
}
}
}
}
else
{
//this.TextBox1.Text += zyb.Rows[i]["正式课题"].ToString().Trim();
}
}