protected void Buttonzsdss_Click(object sender, EventArgs e)//按知识点检索教学资源 { if (TreeView1.CheckedNodes.Count == 0) { ScriptManager.RegisterClientScriptBlock(this, typeof(string), "", "alert('请在左侧知识树中勾选知识点!');", true); return; } HFziyuanlx.Value = "zhishidian"; List <int> zhishidianids = new List <int>(); GetZhisshidianids(zhishidianids); if (username != null && usershenfen != null)//对登录用户 { string ziyuanleixing = DropDownListziyuanleixing.SelectedValue; string meitileixing = DropDownListmeitileixing.SelectedValue; DataTable dt = ZiyuanInfo.GetZiyuan(zhishidianids, username, usershenfen, ziyuanleixing, meitileixing); GridView1.DataSource = dt; GridView1.DataBind(); } else//对游客 { string ziyuanleixing = DropDownListziyuanleixing.SelectedValue; string meitileixing = DropDownListmeitileixing.SelectedValue; DataTable dt = ZiyuanInfo.GetZiyuan(zhishidianids, ziyuanleixing, meitileixing); GridView1.DataSource = dt; GridView1.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e)//按关键字检索教学资源 { HFziyuanlx.Value = "guanjinazi"; string guanjianzi = TextBox1.Text.Trim(); if (username != null && usershenfen != null) { GridView1.DataSource = ZiyuanInfo.GetGuanjianziZiyuan(username, usershenfen, guanjianzi); } else { GridView1.DataSource = ZiyuanInfo.GetGuanjianziZiyuan(guanjianzi); } GridView1.DataBind(); }
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { if (TreeView1.CheckedNodes.Count == 0) { ScriptManager.RegisterClientScriptBlock(this, typeof(string), "", "<script language='javscript'>alert('请在左侧知识树中勾选知识点!');</script>", false); return; } switch (HFziyuanlx.Value.Trim()) { case "guanjianzi": string guanjianzi = TextBox1.Text.Trim(); if (username != null) { GridView1.DataSource = ZiyuanInfo.GetGuanjianziZiyuan(username, usershenfen, guanjianzi); } else { GridView1.DataSource = ZiyuanInfo.GetGuanjianziZiyuan(guanjianzi); } GridView1.DataBind(); GridView1.PageIndex = e.NewPageIndex; break; case "zhishidian": List <int> zhishidianids = new List <int>(); GetZhisshidianids(zhishidianids); string ziyuanleixing = DropDownListziyuanleixing.SelectedValue; string meitileixing = DropDownListmeitileixing.SelectedValue; if (username != null && usershenfen != null) { GridView1.DataSource = ZiyuanInfo.GetZiyuan(zhishidianids, username, usershenfen, ziyuanleixing, meitileixing); } else { GridView1.DataSource = ZiyuanInfo.GetZiyuan(zhishidianids, ziyuanleixing, meitileixing); } GridView1.DataBind(); GridView1.PageIndex = e.NewPageIndex; break; default: break; } }