📄 find_cl.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Configuration;
namespace ClassOnline
{
/// <summary>
/// Find_cl 的摘要说明。
/// </summary>
public class Find_cl : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList ddlSchcity;
protected System.Web.UI.WebControls.DropDownList ddlSchtype;
protected System.Web.UI.WebControls.Label lblSchtype;
protected System.Web.UI.WebControls.TextBox txtSchkey;
protected System.Web.UI.WebControls.Button btnNext1;
string strSQL;
SqlConnection objconn;
SqlCommand objcmd;
SqlDataReader dr;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(Session.Count==0) Page.Response.Redirect("default.aspx");
else
if(Session["UserID"].ToString()=="") Page.Response.Redirect("default.aspx");
if(!Page.IsPostBack)
{
ddlSchtype.Items.Add("-=请选择您的学校类型=-");
ddlSchtype.Items.Add("大 学(大学、大专、研究所等)");
ddlSchtype.Items.Add("中 学(高中、初中)");
ddlSchtype.Items.Add("中 专(技校、中专等)");
ddlSchtype.Items.Add("小 学");
objconn=new SqlConnection(ConfigurationSettings.AppSettings["connstr"]);
objconn.Open();
strSQL="select CityName from City where CityProID="+Page.Request["PID"].ToString();
//strSQL="select c_name from city where c_pid=1";
objcmd=new SqlCommand(strSQL,objconn);
dr=objcmd.ExecuteReader();
while(dr.Read())
ddlSchcity.Items.Add(dr["CityName"].ToString());
objconn.Close();
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnNext1.Click += new System.EventHandler(this.btnNext1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnNext1_Click(object sender, System.EventArgs e)
{
if(ddlSchtype.SelectedIndex==0)
lblSchtype.Visible=true;
else
{
string P1,P2,P3;
objconn=new SqlConnection(ConfigurationSettings.AppSettings["connstr"]);
objconn.Open();
P1=ddlSchcity.SelectedItem.Text.ToString();
strSQL="select CityID from City where CityName='"+P1+"'";
objcmd=new SqlCommand(strSQL,objconn);
dr=objcmd.ExecuteReader();
while(dr.Read())
P1=dr[0].ToString();
dr.Close();
objconn.Close();
P2=ddlSchtype.SelectedIndex.ToString();
P3=txtSchkey.Text.ToString();
//Page.Response.Write(P1);
Page.Response.Redirect("Find_cl2.aspx?CityID="+P1+"&CTypeID="+P2+"&kywd="+P3+"&PID="+Page.Request["PID"].ToString());
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -