protected void Button1_Click(object sender, EventArgs e) //搜索知识点相关问题 { HFchaxfs.Value = "zhishidian"; //知识点对应的问题 //从TreeView1中获取知识点id List <int> zhishidianidList = new List <int>(); foreach (TreeNode node in TreeView1.CheckedNodes) { zhishidianidList.Add(int.Parse(node.Value)); addchildren(node, zhishidianidList); } StringBuilder sb = new StringBuilder(); foreach (int s in zhishidianidList) { sb.Append(s.ToString() + ","); } HFshuju.Value = sb.ToString(); DataTable wttable = WentiInfo.GetWenti(zhishidianidList); ViewState["wentitable"] = wttable; GridView1.DataSource = wttable; if (GridView1.PageCount > 0) { GridView1.PageIndex = 0; } GridView1.DataBind(); }
protected void BindWenti() { string ckfs = HFchaxfs.Value.Trim(); DataTable wttable = new DataTable(); switch (ckfs) { case "kecheng": default: int kechengid = int.Parse(HFshuju.Value.Trim()); wttable = WentiInfo.GetWenti(kechengid); ViewState["wentitable"] = wttable; GridView1.DataSource = wttable; break; case "zhishidian": string[] zsdids = HFshuju.Value.Trim().Split(','); List <int> zsdList = new List <int>(); foreach (string s in zsdids) { zsdList.Add(int.Parse(s)); } wttable = WentiInfo.GetWenti(zsdList); ViewState["wentitable"] = wttable; GridView1.DataSource = wttable; break; case "guanjianzi": wttable = WentiInfo.GetWenti(HFshuju.Value.Trim()); ViewState["wentitable"] = wttable; GridView1.DataSource = wttable; break; } GridView1.DataBind(); }
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) { DataTable wttable = new DataTable(); string kechengid = Session["kechengid"].ToString(); TreeNode node = TreeView1.SelectedNode; if (node == TreeView1.Nodes[0]) { HFchaxfs.Value = "kecheng"; wttable = WentiInfo.GetWenti(int.Parse(kechengid)); ViewState["wentitable"] = wttable; GridView1.DataSource = wttable; GridView1.DataBind(); } else { HFchaxfs.Value = "zhishidian"; //从TreeView1中获取知识点id List <int> zhishidianidList = new List <int>(); zhishidianidList.Add(int.Parse(node.Value.Trim())); addchildren(node, zhishidianidList); StringBuilder sb = new StringBuilder(); foreach (int s in zhishidianidList) { sb.Append(s.ToString() + ","); } HFshuju.Value = sb.ToString(); wttable = WentiInfo.GetWenti(zhishidianidList); ViewState["wentitable"] = wttable; GridView1.DataSource = wttable; GridView1.DataBind(); } }
protected void BindMywenti() { string username = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket.Name; string usershenfen = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket.UserData; DataTable dt = WentiInfo.GetWenti(username, usershenfen); GridView1.DataSource = dt; GridView1.DataBind(); }
protected void BindKechengWenti() { string kechengid = Session["kechengid"].ToString(); UpdateKechengTreeview(kechengid); HFshuju.Value = kechengid; HFchaxfs.Value = "kecheng"; DataTable wttable = WentiInfo.GetWenti(int.Parse(kechengid)); ViewState["wentitable"] = wttable; GridView1.DataSource = wttable; GridView1.DataBind(); }
protected void Button2_Click(object sender, EventArgs e)//按关键字搜索问题 { HFchaxfs.Value = "guanjianzi"; string guanjianzi = TextBox2.Text.Trim(); HFshuju.Value = guanjianzi; DataTable wttable = WentiInfo.GetWenti(guanjianzi); ViewState["wentitable"] = wttable; GridView1.DataSource = wttable; if (GridView1.PageCount > 0) { GridView1.PageIndex = 0; } //GridView1.AutoGenerateColumns = true; GridView1.DataBind(); }