/// <summary> /// 初始化栏目 /// </summary> private void InitClass() { slt_ParentClassName.Items.Add(new ListItem("站点顶级栏目", "0")); DataTable dtClass = bllClass.GetDropList(""); DropDownTree.BindToDropDownList(slt_ParentClassName, dtClass, "0"); }
/// <summary> /// 进入编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEdit_Click(object sender, ImageClickEventArgs e) { WeiSha.WebControl.RowEdit img = (WeiSha.WebControl.RowEdit)sender; int index = ((GridViewRow)(img.Parent.Parent)).RowIndex; gvColumns.EditIndex = index; BindData(null, null); //绑定树 DropDownTree tree = (DropDownTree)gvColumns.Rows[index].FindControl("ddlColTree"); Song.Entities.GuideColumns[] cous = Business.Do <IGuide>().GetColumnsAll(couid, null); tree.DataSource = cous; tree.DataTextField = "Gc_title"; tree.DataValueField = "Gc_ID"; tree.Root = 0; tree.DataBind(); tree.Items.Insert(0, new ListItem(" -- 顶级 --", "0")); //当前父级 int pid = Convert.ToInt32(img.CommandArgument); ListItem li = tree.Items.FindByValue(pid.ToString()); if (li != null) { li.Selected = true; } }
/// <summary> /// 编辑当前数据项 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEditEnter_Click(object sender, EventArgs e) { System.Web.UI.WebControls.Button btn = (System.Web.UI.WebControls.Button)sender; int index = ((GridViewRow)(btn.Parent.Parent)).RowIndex; int id = int.Parse(this.gvColumns.DataKeys[index].Value.ToString()); // Song.Entities.GuideColumns col = Business.Do <IGuide>().ColumnsSingle(id); if (col != null) { //名称 TextBox tb = (TextBox)gvColumns.Rows[index].FindControl("tbTitle"); col.Gc_Title = tb.Text.Trim(); //父级 DropDownTree tree = (DropDownTree)gvColumns.Rows[index].FindControl("ddlColTree"); col.Gc_PID = Convert.ToInt32(tree.SelectedValue); //是否可用 CheckBox cb = (CheckBox)gvColumns.Rows[index].FindControl("cbIsUse"); col.Gc_IsUse = cb.Checked; //简介 TextBox tbintro = (TextBox)gvColumns.Rows[index].FindControl("tbIntro"); col.Gc_Intro = tbintro.Text.Trim(); // Business.Do <IGuide>().ColumnsSave(col); } gvColumns.EditIndex = -1; BindData(null, null); }
public static void SetDropDownTreeSelected(DropDownTree ddv, string selValue) { bool flag = false; for (int i = 0; i < ddv.Items.Count; i++) { DropDownTreeItem item = ddv.Items[i]; if (item.Value == selValue) { flag = true; } else if (!flag && (item.Items.Count > 0)) { for (int j = 0; j < item.Items.Count; j++) { if (item.Items[j].Value == selValue) { flag = true; } } } if (flag) { ddv.SelectedValue = selValue; return; } } }
public static void BindDropDownTree(DropDownTree ddv, int typeID) { CodingInfoCollection infos = new CodingAction().QueryCodeInfoList(typeID, ValidState.Valid); DataTable table = new DataTable(); table.Columns.Add(new DataColumn("CodeID", typeof(int))); table.Columns.Add(new DataColumn("ParentCodeID", typeof(int))); table.Columns.Add(new DataColumn("CodeName", typeof(string))); int count = infos.Count; DataRow row = table.NewRow(); row["CodeID"] = "9999"; row["ParentCodeID"] = "0"; row["CodeName"] = "全部".ToString(); table.Rows.Add(row); for (int i = 0; i < count; i++) { DataRow row2 = table.NewRow(); row2["CodeID"] = infos[i].CodeID.ToString(); row2["ParentCodeID"] = infos[i].ParentCodeID.ToString(); row2["CodeName"] = infos[i].CodeName; table.Rows.Add(row2); } ddv.LoadFromTable(table, false, "CodeID", "ParentCodeID", "CodeName", "CodeID"); }
/// <summary> /// 绑定场次中的学科信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void GvItem_RowDataBound(object sender, GridViewRowEventArgs e) { //当为数据行时 if (e.Row.RowType == DataControlRowType.DataRow) { Song.Entities.Organization org = Business.Do <IOrganization>().OrganCurrent(); //学科/专业 DropDownTree ddl = (DropDownTree)e.Row.FindControl("ddlSubject"); if (this.sbjs == null) { sbjs = Business.Do <ISubject>().SubjectCount(org.Org_ID, null, true, -1, 0); foreach (Song.Entities.Subject s in this.sbjs) { int count = Business.Do <ITestPaper>().PagerOfCount(org.Org_ID, s.Sbj_ID, -1, -1, true); s.Sbj_Name = s.Sbj_Name + " (" + count + ")"; } } ddl.DataSource = sbjs; ddl.DataTextField = "Sbj_Name"; ddl.DataValueField = "Sbj_ID"; ddl.Root = 0; ddl.DataBind(); ddl.Items.Insert(0, new ListItem(ddl.Items.Count < 1 ? "--(没有专业)--" : "", "-1")); //当前选中状态 Song.Entities.Examination exam = (Song.Entities.Examination)e.Row.DataItem; ListItem liSubj = ddl.Items.FindByValue(exam.Sbj_ID.ToString()); if (liSubj != null) { liSubj.Selected = true; } //当前试卷 if (exam.Sbj_ID > 0) { Song.Entities.TestPaper[] tps = Business.Do <ITestPaper>().PagerCount(org.Org_ID, (int)exam.Sbj_ID, -1, -1, true, 0); DropDownList tpDdl = (DropDownList)e.Row.FindControl("ddlTestPager"); tpDdl.DataSource = tps; tpDdl.DataTextField = "Tp_Name"; tpDdl.DataValueField = "Tp_Id"; tpDdl.DataBind(); for (int i = 0; i < tps.Length; i++) { tpDdl.Items[i].Attributes.Add("span", tps[i].Tp_Span.ToString()); tpDdl.Items[i].Attributes.Add("total", tps[i].Tp_Total.ToString()); tpDdl.Items[i].Attributes.Add("passScore", tps[i].Tp_PassScore.ToString()); } ListItem liTp = tpDdl.Items.FindByValue(exam.Tp_Id.ToString()); if (liTp != null) { liTp.Selected = true; } } } }
protected void Page_Load(object sender, EventArgs e) { this.Label1.Text = "从缓存中获取xml方法:"; this.Label2.Text = "从缓存中直接获取:"; Response.Write(DateTime.Now.ToString("yyyy/MM/dd mm:ss")); BLL.Arc_ClassBLL b = new DTCMS.BLL.Arc_ClassBLL(); DataTable dt = b.GetDropList(""); DropDownTree.BindToDropDownList(DropDownList1, dt, "0"); }
protected void Page_Load(object sender, EventArgs e) { Ajax.RegMethod(AddTuanGou); cityList = CityDAO.Instance.GetCityList(); DataTable category = CategoryDAO.Instance.GetDataList(); DropDownTree.BindToDropDownList(ddl_Category, category, "0"); tuanID = Utils.GetQueryInt("ID"); if (tuanID > 0) { TuanGou tuanGou = TuanGouDAO.Instance.GetModel(tuanID); if (tuanGou != null) { txt_Title.Value = tuanGou.Title; cityID = tuanGou.CityID; hid_SiteID.Value = tuanGou.SiteID.ToString(); ddl_Category.Value = tuanGou.CategoryID.ToString(); txt_Description.Value = tuanGou.Description; txt_MarketPrice.Value = tuanGou.MarketPrice.ToString(); txt_TuanPrice.Value = tuanGou.TuanPrice.ToString(); txt_Rebate.Value = tuanGou.Rebate.ToString(); txt_TotalCount.Value = tuanGou.TotalCount.ToString(); txt_BuyCount.Value = tuanGou.BuyCount.ToString(); txt_ClickCount.Value = tuanGou.ClickCount.ToString(); txt_CommentCount.Value = tuanGou.CommentCount.ToString(); txt_PointCount.Value = tuanGou.PointCount.ToString(); txt_BeginTime.Value = tuanGou.BeginTime.ToString(); txt_EndTime.Value = tuanGou.EndTime.ToString(); txt_TuanUrl.Value = tuanGou.TuanUrl; txt_ImageThumbUrl.Value = tuanGou.ImageThumbUrl; txt_ImageUrl.Value = tuanGou.ImageUrl; txt_MerchantName.Value = tuanGou.MerchantName; txt_MerchantAddress.Value = tuanGou.MerchantAddress; txt_MerchantPhone.Value = tuanGou.MerchantPhone; txt_Longitude.Value = tuanGou.Longitude.ToString(); txt_Latitude.Value = tuanGou.Latitude.ToString(); txt_Rank.Value = tuanGou.Rank.ToString(); hid_Statu.Value = tuanGou.Statu.ToString(); txt_OrderID.Value = tuanGou.OrderID.ToString(); } } }
public static void BindDropDownTree(DropDownTree ddv, BasicType bType) { int typeID = Convert.ToInt32(bType); BindDropDownTree(ddv, typeID); }