/// <summary> /// 父级属性名称 /// </summary> /// <param name="parentId"></param> /// <param name="properName"></param> /// <returns></returns> protected string GetName(object pid) { ProperType item = ProperTypeService.GetModel(Convert.ToInt32(pid)); if (item != null) { return(item.properName); } return(""); }
/// <summary> /// 控件行命令事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.Equals("del")) { int id = Convert.ToInt32(e.CommandArgument); ProperTypeService.Delete(id); sp.InitBindData(repInfo, pager1, "ProperType", "id", sear()); } if (e.CommandName.Equals("mod")) { int id = Convert.ToInt32(e.CommandArgument); ProperType item = ProperTypeService.GetModel(id); if (item != null) { this.ddlProductType.SelectedValue = item.infoType.ToString(); if (item.parentId == 0) { txtPropertyName.Text = item.properName; } else { DataSet ds = ProperTypeService.GetList("parentId = 0 and infoType = " + item.infoType); ddlOne.Items.Clear(); if (ds.Tables[0].Rows.Count > 0) { ddlOne.DataSource = ds; ddlOne.DataTextField = "properName"; ddlOne.DataValueField = "id"; ddlOne.DataBind(); } ddlOne.Items.Insert(0, new ListItem("请选择", "0")); ddlOne.SelectedValue = item.parentId.ToString(); txtPropertyName.Text = item.properName; if (item.status == 1) { cboTj.Checked = true; } else { cboTj.Checked = false; } } } ViewState["modId"] = id; ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "overKeyWordDiv();", true); } }
/// <summary> /// 父级属性名称 /// </summary> /// <param name="parentId"></param> /// <param name="properName"></param> /// <returns></returns> protected string GetParentName(object pid, object properName) { int parentId = Convert.ToInt32(pid); if (parentId != 0) { ProperType item = ProperTypeService.GetModel(parentId); if (item != null) { return(item.properName); } return(""); } else { return("顶级"); } }