怎样在onclick事件中传值?(在线=) <a href="index_bblb_xx.aspx" onclick="Session['aaa'] = 'aaa';">aaaaa</a>我是想在页面上点击连接后在session["aaa"]中放个值 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 upupupupup try<a id="link1" href="index_bblb_xx.aspx" runat="server">aaaaa</a>page_loadif(!Page.IsPostBack){ this.link1.Attributes.Add("onclick",Session['aaa'] = 'aaa');} 不知道,你具体想做什么,照本人理解,是这样些个隐藏域,把值付给隐藏域,然后在通过JS调用。<input id="ok" type="hidden" runat="server">.csif(Session['aaa']!=null){ ok.Value = Session['aaa'].ToString();}this.link1.Attributes.Add("onclick","javascript:check()");.aspxfunction check(){ strValue = ok.value;} upupupupup 我的意思是一个链接,点一下,生成一个session但是因为这个连接又是动态生成的,所以不能用Attributes 呵呵,楼主不会想像模拟登陆一样进入需要验证的网页吧?呵呵,如果是这样恐怕难度有些大,呵呵。JS里面好像不能用SESSION吧,学习一下 用个隐藏的input,设为服务器端运行, js可以访问它的值,后台代码C#也能访问 你想实现功能,说清楚点也许没这么麻烦学习asp.net的资料http://218.27.204.17/aspnet/a_user.aspx <a href="index_bblb_xx.aspx ? xx=aa " onclick="Session['aaa'] = 'aaa';">aaaaa</a>在index_bblb_xx.aspx 获得页面参数 然后处理 这样应该灵活点 private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e) { if(label_isstu.Text=="学生") { string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL ="exec Tstu_oncou '" + Request.Form["DropDownList1"] + "','" + label_user.Text + "'"; SqlConnection objConnection=new SqlConnection (strConnection); SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open (); CheckBoxList1.DataSource = objCommand.ExecuteReader (); CheckBoxList1.DataTextField ="cou_name"; CheckBoxList1.DataBind (); objConnection.Close (); } else { ListItem li2=DropDownList2.SelectedItem; ListItem li3=DropDownList3.SelectedItem; ListItem li4=DropDownList4.SelectedItem; //*************************************************************** string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL ="exec change_ondep '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_dep + "'"; SqlConnection objConnection=new SqlConnection (strConnection); SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open (); DropDownList2.DataSource = objCommand.ExecuteReader(); DropDownList2.DataTextField ="dep_name"; DropDownList2.DataBind (); objConnection.Close (); DropDownList2.Items.Insert(0,"全部"); DropDownList2.SelectedIndex=DropDownList2.Items.IndexOf(li2); //***************************************************************************** //string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL2 ="exec change_ongrade '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList4"] + "','" + str_grade + "'"; //SqlConnection objConnection=new SqlConnection (strConnection); objCommand=new SqlCommand(strSQL2,objConnection); objConnection.Open (); DropDownList3.DataSource = objCommand.ExecuteReader (); DropDownList3.DataTextField ="grade"; DropDownList3.DataBind (); objConnection.Close (); DropDownList3.Items.Insert(0,"全部"); DropDownList3.SelectedIndex=DropDownList3.Items.IndexOf(li3); //************************************************************************** string strSQL3 ="exec change_onclass '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + str_class + "'"; objCommand=new SqlCommand(strSQL3,objConnection); objConnection.Open (); DropDownList4.DataSource = objCommand.ExecuteReader (); DropDownList4.DataTextField ="class"; DropDownList4.DataBind (); objConnection.Close (); DropDownList4.Items.Insert(0,"全部"); DropDownList4.SelectedIndex=DropDownList4.Items.IndexOf(li4); //****************************************************************** string strSQL4 ="exec change_oncou '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_cou + "'"; objCommand=new SqlCommand(strSQL4,objConnection); objConnection.Open (); CheckBoxList1.DataSource = objCommand.ExecuteReader (); CheckBoxList1.DataTextField ="cou_name"; CheckBoxList1.DataBind (); objConnection.Close (); } } private void DropDownList2_SelectedIndexChanged(object sender, System.EventArgs e) { ListItem li1=DropDownList1.SelectedItem; ListItem li3=DropDownList3.SelectedItem; ListItem li4=DropDownList4.SelectedItem; //**************************************************************** string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL ="exec change_onscore_time '" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_score_time + "'"; SqlConnection objConnection=new SqlConnection (strConnection); SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open (); DropDownList1.DataSource = objCommand.ExecuteReader(); DropDownList1.DataTextField ="score_time"; DropDownList1.DataBind (); objConnection.Close (); DropDownList1.Items.Insert(0,"全部"); DropDownList1.SelectedIndex=DropDownList1.Items.IndexOf(li1); //************************************************************* //string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL2 ="exec change_ongrade '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList4"] +"','" + str_grade + "'"; //SqlConnection objConnection=new SqlConnection (strConnection); objCommand=new SqlCommand(strSQL2,objConnection); objConnection.Open (); DropDownList3.DataSource = objCommand.ExecuteReader(); DropDownList3.DataTextField ="grade"; DropDownList3.DataBind (); objConnection.Close (); DropDownList3.Items.Insert(0,"全部"); DropDownList3.SelectedIndex=DropDownList3.Items.IndexOf(li3); //************************************************************************ string strSQL3 ="exec change_onclass '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + str_class + "'"; objCommand=new SqlCommand(strSQL3,objConnection); objConnection.Open (); DropDownList4.DataSource = objCommand.ExecuteReader(); DropDownList4.DataTextField ="class"; DropDownList4.DataBind (); objConnection.Close (); DropDownList4.Items.Insert(0,"全部"); DropDownList4.SelectedIndex=DropDownList4.Items.IndexOf(li4); //****************************************************************** string strSQL4 ="exec change_oncou '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_cou + "'"; objCommand=new SqlCommand(strSQL4,objConnection); objConnection.Open (); CheckBoxList1.DataSource = objCommand.ExecuteReader (); CheckBoxList1.DataTextField ="cou_name"; CheckBoxList1.DataBind (); objConnection.Close (); } private void DropDownList3_SelectedIndexChanged(object sender, System.EventArgs e) { ListItem li1=DropDownList1.SelectedItem; ListItem li2=DropDownList2.SelectedItem; ListItem li4=DropDownList4.SelectedItem; //***************************************************************** string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL ="exec change_onscore_time '" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_score_time + "'"; SqlConnection objConnection=new SqlConnection (strConnection); SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open (); DropDownList1.DataSource = objCommand.ExecuteReader(); DropDownList1.DataTextField ="score_time"; DropDownList1.DataBind (); objConnection.Close (); DropDownList1.Items.Insert(0,"全部"); DropDownList1.SelectedIndex=DropDownList1.Items.IndexOf(li1); //**************************************************************** //string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL2 ="exec change_ondep '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_dep + "'"; //SqlConnection objConnection=new SqlConnection (strConnection); objCommand=new SqlCommand(strSQL2,objConnection); objConnection.Open (); DropDownList2.DataSource = objCommand.ExecuteReader(); DropDownList2.DataTextField ="dep_name"; DropDownList2.DataBind (); objConnection.Close (); DropDownList2.Items.Insert(0,"全部"); DropDownList2.SelectedIndex=DropDownList2.Items.IndexOf(li2); //****************************************************************** string strSQL3 ="exec change_onclass '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + str_class + "'"; objCommand=new SqlCommand(strSQL3,objConnection); objConnection.Open (); DropDownList4.DataSource = objCommand.ExecuteReader(); DropDownList4.DataTextField ="class"; DropDownList4.DataBind (); objConnection.Close (); DropDownList4.Items.Insert(0,"全部"); DropDownList4.SelectedIndex=DropDownList4.Items.IndexOf(li4); //************************************************************ string strSQL4 ="exec change_oncou '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_cou + "'"; objCommand=new SqlCommand(strSQL4,objConnection); objConnection.Open (); CheckBoxList1.DataSource = objCommand.ExecuteReader (); CheckBoxList1.DataTextField ="cou_name"; CheckBoxList1.DataBind (); objConnection.Close (); } private void DropDownList4_SelectedIndexChanged(object sender, System.EventArgs e) { ListItem li1=DropDownList1.SelectedItem; ListItem li2=DropDownList2.SelectedItem; ListItem li3=DropDownList3.SelectedItem; //***************************************************************** string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL ="exec change_onscore_time '" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_score_time + "'"; SqlConnection objConnection=new SqlConnection (strConnection); SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open (); DropDownList1.DataSource = objCommand.ExecuteReader(); DropDownList1.DataTextField ="score_time"; DropDownList1.DataBind (); objConnection.Close (); DropDownList1.Items.Insert(0,"全部"); DropDownList1.SelectedIndex=DropDownList1.Items.IndexOf(li1); //********************************************************** //string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL2 ="exec change_ondep '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_dep + "'"; //SqlConnection objConnection=new SqlConnection (strConnection); objCommand=new SqlCommand(strSQL2,objConnection); objConnection.Open (); DropDownList2.DataSource = objCommand.ExecuteReader(); DropDownList2.DataTextField ="dep_name"; DropDownList2.DataBind (); objConnection.Close (); DropDownList2.Items.Insert(0,"全部"); DropDownList2.SelectedIndex=DropDownList2.Items.IndexOf(li2); //****************************************************************** string strSQL3 ="exec change_ongrade '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList4"] +"','" + str_grade + "'"; objCommand=new SqlCommand(strSQL3,objConnection); objConnection.Open (); DropDownList3.DataSource = objCommand.ExecuteReader(); DropDownList3.DataTextField ="grade"; DropDownList3.DataBind (); objConnection.Close (); DropDownList3.Items.Insert(0,"全部"); DropDownList3.SelectedIndex=DropDownList3.Items.IndexOf(li3); //***************************************************************** string strSQL4 ="exec change_oncou '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_cou + "'"; objCommand=new SqlCommand(strSQL4,objConnection); objConnection.Open (); CheckBoxList1.DataSource = objCommand.ExecuteReader (); CheckBoxList1.DataTextField ="cou_name"; CheckBoxList1.DataBind (); objConnection.Close (); } private void Button2_Click(object sender, System.EventArgs e) { if(true) { string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL ="exec load_score_time '" + label_user.Text + "','" + label_isstu.Text + "'"; SqlConnection objConnection=new SqlConnection (strConnection); SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open (); DropDownList1.DataSource = objCommand.ExecuteReader (); DropDownList1.DataTextField ="score_time"; DropDownList1.DataBind (); objConnection.Close (); DropDownList1.Items.Insert(0,"全部"); DropDownList1.Items[0].Selected=true; } if(true) { if(label_isstu.Text=="学生") { //do nothing } else { string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL ="exec load_dep '" + label_user.Text + "','" + label_isstu.Text + "'"; SqlConnection objConnection=new SqlConnection (strConnection); SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open (); DropDownList2.DataSource = objCommand.ExecuteReader (); DropDownList2.DataTextField ="dep_name"; DropDownList2.DataBind (); objConnection.Close (); DropDownList2.Items.Insert(0,"全部"); DropDownList2.Items[0].Selected=true; } } if(true) { if(label_isstu.Text=="学生") { //do nothing } else { string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL ="exec load_grade '" + label_user.Text + "','" + label_isstu.Text + "'"; SqlConnection objConnection=new SqlConnection (strConnection); SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open (); DropDownList3.DataSource = objCommand.ExecuteReader (); DropDownList3.DataTextField ="grade"; DropDownList3.DataBind (); objConnection.Close (); DropDownList3.Items.Insert(0,"全部"); DropDownList3.Items[0].Selected=true; } } if(true) { if(label_isstu.Text=="学生") { //do nothing } else { string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL ="exec load_class '" + label_user.Text + "','" + label_isstu.Text + "'"; SqlConnection objConnection=new SqlConnection (strConnection); SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open (); DropDownList4.DataSource = objCommand.ExecuteReader (); DropDownList4.DataTextField ="class"; DropDownList4.DataBind (); objConnection.Close (); DropDownList4.Items.Insert(0,"全部"); DropDownList4.Items[0].Selected=true; } } if(true) { string strConnection="server=(local);database=temp;uid=sa;password=;"; string strSQL ="exec load_cou '" + label_user.Text + "','" + label_isstu.Text + "'"; SqlConnection objConnection=new SqlConnection (strConnection); SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open (); CheckBoxList1.DataSource = objCommand.ExecuteReader (); CheckBoxList1.DataTextField ="cou_name"; CheckBoxList1.DataBind (); objConnection.Close (); } if(true) { if(label_isstu.Text=="学生") { //do nothing } else { TextBox1.Text=""; } } } private void CheckBoxList1_SelectedIndexChanged(object sender, System.EventArgs e) { //do nothing } private void Button3_Click(object sender, System.EventArgs e) { //全选 for(int i=0;i < CheckBoxList1.Items.Count;i++) { CheckBoxList1.Items[i].Selected=true; } } private void Button4_Click(object sender, System.EventArgs e) { //全不选 for(int i=0;i < CheckBoxList1.Items.Count;i++) { CheckBoxList1.Items[i].Selected=false; } } }} asp.net mvc跟jsp mvc的区别 FLASH 上传文件完后如何通知前台页面?如何通信? 急,asp.net中序列化问题 誰有下拉式的日期控件 睡前最后三个菜鸟问题 fckeditor控件在本地测试通过,但是传到外网后无法显示 数据库增量问题!!! 关于子窗口对父窗口的控制问题!!急。。在线等待! RadioButtonList的问题,急救 大家帮我看看这个代码有没有错误!在线等待! Text Feild的属性可以设置灰显,TextBox怎么灰显? 请教:怎样把数据库中创建的视图读到datareader或dataset中?
up
up
up
up
<a id="link1" href="index_bblb_xx.aspx" runat="server">aaaaa</a>page_load
if(!Page.IsPostBack)
{
this.link1.Attributes.Add("onclick",Session['aaa'] = 'aaa');
}
<input id="ok" type="hidden" runat="server">.cs
if(Session['aaa']!=null)
{
ok.Value = Session['aaa'].ToString();
}
this.link1.Attributes.Add("onclick","javascript:check()");.aspx
function check()
{
strValue = ok.value;
}
up
up
up
up
一个链接,点一下,生成一个session
但是因为这个连接又是动态生成的,所以不能用Attributes
也许没这么麻烦
学习asp.net的资料
http://218.27.204.17/aspnet/a_user.aspx
在index_bblb_xx.aspx 获得页面参数 然后处理
这样应该灵活点
{
if(label_isstu.Text=="学生")
{
string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL ="exec Tstu_oncou '" + Request.Form["DropDownList1"] + "','" + label_user.Text + "'"; SqlConnection objConnection=new SqlConnection (strConnection);
SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open ();
CheckBoxList1.DataSource = objCommand.ExecuteReader ();
CheckBoxList1.DataTextField ="cou_name";
CheckBoxList1.DataBind ();
objConnection.Close (); }
else
{ ListItem li2=DropDownList2.SelectedItem;
ListItem li3=DropDownList3.SelectedItem;
ListItem li4=DropDownList4.SelectedItem;
//***************************************************************
string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL ="exec change_ondep '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_dep + "'"; SqlConnection objConnection=new SqlConnection (strConnection);
SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open ();
DropDownList2.DataSource = objCommand.ExecuteReader();
DropDownList2.DataTextField ="dep_name";
DropDownList2.DataBind ();
objConnection.Close (); DropDownList2.Items.Insert(0,"全部");
DropDownList2.SelectedIndex=DropDownList2.Items.IndexOf(li2);
//*****************************************************************************
//string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL2 ="exec change_ongrade '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList4"] + "','" + str_grade + "'"; //SqlConnection objConnection=new SqlConnection (strConnection);
objCommand=new SqlCommand(strSQL2,objConnection); objConnection.Open ();
DropDownList3.DataSource = objCommand.ExecuteReader ();
DropDownList3.DataTextField ="grade";
DropDownList3.DataBind ();
objConnection.Close (); DropDownList3.Items.Insert(0,"全部");
DropDownList3.SelectedIndex=DropDownList3.Items.IndexOf(li3);
//**************************************************************************
string strSQL3 ="exec change_onclass '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + str_class + "'"; objCommand=new SqlCommand(strSQL3,objConnection); objConnection.Open ();
DropDownList4.DataSource = objCommand.ExecuteReader ();
DropDownList4.DataTextField ="class";
DropDownList4.DataBind ();
objConnection.Close (); DropDownList4.Items.Insert(0,"全部");
DropDownList4.SelectedIndex=DropDownList4.Items.IndexOf(li4);
//******************************************************************
string strSQL4 ="exec change_oncou '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_cou + "'"; objCommand=new SqlCommand(strSQL4,objConnection); objConnection.Open ();
CheckBoxList1.DataSource = objCommand.ExecuteReader ();
CheckBoxList1.DataTextField ="cou_name";
CheckBoxList1.DataBind ();
objConnection.Close ();
} } private void DropDownList2_SelectedIndexChanged(object sender, System.EventArgs e)
{ ListItem li1=DropDownList1.SelectedItem;
ListItem li3=DropDownList3.SelectedItem;
ListItem li4=DropDownList4.SelectedItem;
//****************************************************************
string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL ="exec change_onscore_time '" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_score_time + "'";
SqlConnection objConnection=new SqlConnection (strConnection);
SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open ();
DropDownList1.DataSource = objCommand.ExecuteReader();
DropDownList1.DataTextField ="score_time";
DropDownList1.DataBind ();
objConnection.Close ();
DropDownList1.Items.Insert(0,"全部");
DropDownList1.SelectedIndex=DropDownList1.Items.IndexOf(li1);
//*************************************************************
//string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL2 ="exec change_ongrade '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList4"] +"','" + str_grade + "'";
//SqlConnection objConnection=new SqlConnection (strConnection);
objCommand=new SqlCommand(strSQL2,objConnection); objConnection.Open ();
DropDownList3.DataSource = objCommand.ExecuteReader();
DropDownList3.DataTextField ="grade";
DropDownList3.DataBind ();
objConnection.Close (); DropDownList3.Items.Insert(0,"全部");
DropDownList3.SelectedIndex=DropDownList3.Items.IndexOf(li3);
//************************************************************************
string strSQL3 ="exec change_onclass '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + str_class + "'";
objCommand=new SqlCommand(strSQL3,objConnection); objConnection.Open ();
DropDownList4.DataSource = objCommand.ExecuteReader();
DropDownList4.DataTextField ="class";
DropDownList4.DataBind ();
objConnection.Close (); DropDownList4.Items.Insert(0,"全部");
DropDownList4.SelectedIndex=DropDownList4.Items.IndexOf(li4);
//******************************************************************
string strSQL4 ="exec change_oncou '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_cou + "'"; objCommand=new SqlCommand(strSQL4,objConnection); objConnection.Open ();
CheckBoxList1.DataSource = objCommand.ExecuteReader ();
CheckBoxList1.DataTextField ="cou_name";
CheckBoxList1.DataBind ();
objConnection.Close ();
} private void DropDownList3_SelectedIndexChanged(object sender, System.EventArgs e)
{ ListItem li1=DropDownList1.SelectedItem;
ListItem li2=DropDownList2.SelectedItem;
ListItem li4=DropDownList4.SelectedItem;
string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL ="exec change_onscore_time '" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_score_time + "'";
SqlConnection objConnection=new SqlConnection (strConnection);
SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open ();
DropDownList1.DataSource = objCommand.ExecuteReader();
DropDownList1.DataTextField ="score_time";
DropDownList1.DataBind ();
objConnection.Close ();
DropDownList1.Items.Insert(0,"全部");
DropDownList1.SelectedIndex=DropDownList1.Items.IndexOf(li1);
//****************************************************************
//string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL2 ="exec change_ondep '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_dep + "'"; //SqlConnection objConnection=new SqlConnection (strConnection);
objCommand=new SqlCommand(strSQL2,objConnection); objConnection.Open ();
DropDownList2.DataSource = objCommand.ExecuteReader();
DropDownList2.DataTextField ="dep_name";
DropDownList2.DataBind ();
objConnection.Close (); DropDownList2.Items.Insert(0,"全部");
DropDownList2.SelectedIndex=DropDownList2.Items.IndexOf(li2);
//******************************************************************
string strSQL3 ="exec change_onclass '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + str_class + "'"; objCommand=new SqlCommand(strSQL3,objConnection); objConnection.Open ();
DropDownList4.DataSource = objCommand.ExecuteReader();
DropDownList4.DataTextField ="class";
DropDownList4.DataBind ();
objConnection.Close (); DropDownList4.Items.Insert(0,"全部");
DropDownList4.SelectedIndex=DropDownList4.Items.IndexOf(li4);
//************************************************************
string strSQL4 ="exec change_oncou '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_cou + "'"; objCommand=new SqlCommand(strSQL4,objConnection); objConnection.Open ();
CheckBoxList1.DataSource = objCommand.ExecuteReader ();
CheckBoxList1.DataTextField ="cou_name";
CheckBoxList1.DataBind ();
objConnection.Close ();
} private void DropDownList4_SelectedIndexChanged(object sender, System.EventArgs e)
{ ListItem li1=DropDownList1.SelectedItem;
ListItem li2=DropDownList2.SelectedItem;
ListItem li3=DropDownList3.SelectedItem;
//*****************************************************************
string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL ="exec change_onscore_time '" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_score_time + "'";
SqlConnection objConnection=new SqlConnection (strConnection);
SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open ();
DropDownList1.DataSource = objCommand.ExecuteReader();
DropDownList1.DataTextField ="score_time";
DropDownList1.DataBind ();
objConnection.Close ();
DropDownList1.Items.Insert(0,"全部");
DropDownList1.SelectedIndex=DropDownList1.Items.IndexOf(li1);
//**********************************************************
//string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL2 ="exec change_ondep '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_dep + "'"; //SqlConnection objConnection=new SqlConnection (strConnection);
objCommand=new SqlCommand(strSQL2,objConnection); objConnection.Open ();
DropDownList2.DataSource = objCommand.ExecuteReader();
DropDownList2.DataTextField ="dep_name";
DropDownList2.DataBind ();
objConnection.Close (); DropDownList2.Items.Insert(0,"全部");
DropDownList2.SelectedIndex=DropDownList2.Items.IndexOf(li2);
//******************************************************************
string strSQL3 ="exec change_ongrade '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList4"] +"','" + str_grade + "'";
objCommand=new SqlCommand(strSQL3,objConnection); objConnection.Open ();
DropDownList3.DataSource = objCommand.ExecuteReader();
DropDownList3.DataTextField ="grade";
DropDownList3.DataBind ();
objConnection.Close (); DropDownList3.Items.Insert(0,"全部");
DropDownList3.SelectedIndex=DropDownList3.Items.IndexOf(li3);
string strSQL4 ="exec change_oncou '" + Request.Form["DropDownList1"] + "','" + Request.Form["DropDownList2"] + "','" + Request.Form["DropDownList3"] + "','" + Request.Form["DropDownList4"] + "','" + str_cou + "'"; objCommand=new SqlCommand(strSQL4,objConnection); objConnection.Open ();
CheckBoxList1.DataSource = objCommand.ExecuteReader ();
CheckBoxList1.DataTextField ="cou_name";
CheckBoxList1.DataBind ();
objConnection.Close ();
} private void Button2_Click(object sender, System.EventArgs e)
{
if(true)
{
string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL ="exec load_score_time '" + label_user.Text + "','" + label_isstu.Text + "'";
SqlConnection objConnection=new SqlConnection (strConnection);
SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open ();
DropDownList1.DataSource = objCommand.ExecuteReader ();
DropDownList1.DataTextField ="score_time";
DropDownList1.DataBind ();
objConnection.Close (); DropDownList1.Items.Insert(0,"全部");
DropDownList1.Items[0].Selected=true; } if(true)
{
if(label_isstu.Text=="学生")
{
//do nothing
}
else
{
string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL ="exec load_dep '" + label_user.Text + "','" + label_isstu.Text + "'";
SqlConnection objConnection=new SqlConnection (strConnection);
SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open ();
DropDownList2.DataSource = objCommand.ExecuteReader ();
DropDownList2.DataTextField ="dep_name";
DropDownList2.DataBind ();
objConnection.Close ();
DropDownList2.Items.Insert(0,"全部");
DropDownList2.Items[0].Selected=true; }
} if(true)
{
if(label_isstu.Text=="学生")
{
//do nothing
}
else
{
string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL ="exec load_grade '" + label_user.Text + "','" + label_isstu.Text + "'";
SqlConnection objConnection=new SqlConnection (strConnection);
SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open ();
DropDownList3.DataSource = objCommand.ExecuteReader ();
DropDownList3.DataTextField ="grade";
DropDownList3.DataBind ();
objConnection.Close ();
DropDownList3.Items.Insert(0,"全部");
DropDownList3.Items[0].Selected=true; }
} if(true)
{
if(label_isstu.Text=="学生")
{
//do nothing
}
else
{
string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL ="exec load_class '" + label_user.Text + "','" + label_isstu.Text + "'";
SqlConnection objConnection=new SqlConnection (strConnection);
SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open ();
DropDownList4.DataSource = objCommand.ExecuteReader ();
DropDownList4.DataTextField ="class";
DropDownList4.DataBind ();
objConnection.Close ();
DropDownList4.Items.Insert(0,"全部");
DropDownList4.Items[0].Selected=true; }
} if(true)
{
string strConnection="server=(local);database=temp;uid=sa;password=;";
string strSQL ="exec load_cou '" + label_user.Text + "','" + label_isstu.Text + "'";
SqlConnection objConnection=new SqlConnection (strConnection);
SqlCommand objCommand=new SqlCommand(strSQL,objConnection); objConnection.Open ();
CheckBoxList1.DataSource = objCommand.ExecuteReader ();
CheckBoxList1.DataTextField ="cou_name";
CheckBoxList1.DataBind ();
objConnection.Close ();
} if(true)
{
if(label_isstu.Text=="学生")
{
//do nothing
}
else
{
TextBox1.Text=""; }
} } private void CheckBoxList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
//do nothing
} private void Button3_Click(object sender, System.EventArgs e)
{
//全选
for(int i=0;i < CheckBoxList1.Items.Count;i++)
{
CheckBoxList1.Items[i].Selected=true; } } private void Button4_Click(object sender, System.EventArgs e)
{
//全不选
for(int i=0;i < CheckBoxList1.Items.Count;i++)
{
CheckBoxList1.Items[i].Selected=false; }
}
}
}