//建立页面 private void BuildView() { Clothes clothes = new Clothes(); NewID.Text = clothes.GetNewID().ToString(); DataTable data = null; TypeList type = new TypeList(); data = type.ReadAll(); TypeRadio.DataSource = data; TypeRadio.DataTextField = "name"; TypeRadio.DataValueField = "id"; TypeRadio.DataBind(); PlaceList place = new PlaceList(); data = place.ReadAll(); PlaceRadio.DataSource = data; PlaceRadio.DataTextField = "name"; PlaceRadio.DataValueField = "id"; PlaceRadio.DataBind(); }
protected void Change_Click(object sender, EventArgs e) { ConditionRadio.Visible = true; GradeRadio.Visible = true; PlaceRadio.Visible = true; TypeRadio.Visible = true; SeatText.Visible = true; DescribeText.Visible = true; Restore.Visible = true; Save.Visible = true; labelFileUpload.Visible = true; Delete.Visible = false; Return.Visible = false; Change.Visible = false; SeatLabel.Visible = false; DescribeLabel.Visible = false; TypeList type = new TypeList(); DataTable data = type.ReadAll(); TypeRadio.DataSource = data; TypeRadio.DataTextField = "name"; TypeRadio.DataValueField = "id"; TypeRadio.DataBind(); PlaceList place = new PlaceList(); data = place.ReadAll(); PlaceRadio.DataSource = data; PlaceRadio.DataTextField = "name"; PlaceRadio.DataValueField = "id"; PlaceRadio.DataBind(); //设置默认选择项 ConditionRadio.SelectedValue = ConditionLabel.ToolTip; GradeRadio.SelectedValue = GradeLabel.ToolTip; PlaceRadio.SelectedValue = PlaceLabe.ToolTip; TypeRadio.SelectedValue = TypeLabel.ToolTip; SeatText.Text = SeatLabel.Text; DescribeText.Value = DescribeLabel.Text; }
void BuildCheckList() { //分类表 TypeList type = new TypeList(); DataTable Data = type.ReadAll(); Type_CBL.DataSource = Data; Type_CBL.DataTextField = "name"; Type_CBL.DataValueField = "id"; Type_CBL.DataBind(); //地点表 PlaceList site = new PlaceList(); Data = site.ReadAll(); Site_CBL.DataSource = Data; Site_CBL.DataTextField = "name"; Site_CBL.DataValueField = "id"; Site_CBL.DataBind(); //获取cookie HttpCookie cookie = HttpContext.Current.Request.Cookies["find"]; //将cookie转化为字典 Dictionary <string, string> dict = null; if (cookie != null) { if (cookie.Value != "") { dict = new Dictionary <string, string>(); foreach (string key in cookie.Values) { dict.Add(key, cookie[key]); } } else { return; } } //置默认选中 string[] str; foreach (var item in dict) { switch (item.Key) { case "type": str = item.Value.Split(','); foreach (string value in str) { foreach (ListItem listItem in Type_CBL.Items) { if (value == listItem.Value) { listItem.Selected = true; } else { continue; } } } break; case "condition": str = item.Value.Split(','); foreach (string value in str) { foreach (ListItem listItem in Condition_CBL.Items) { if (value == listItem.Value) { listItem.Selected = true; } else { continue; } } } break; case "grade": str = item.Value.Split(','); foreach (string value in str) { foreach (ListItem listItem in Grade_CBL.Items) { if (value == listItem.Value) { listItem.Selected = true; } else { continue; } } } break; case "place": str = item.Value.Split(','); foreach (string value in str) { foreach (ListItem listItem in Site_CBL.Items) { if (value == listItem.Value) { listItem.Selected = true; } else { continue; } } } break; case "seat": SeatText.Text = HttpUtility.UrlDecode(item.Value); break; case "describe": DescribeText.Text = HttpUtility.UrlDecode(item.Value); break; } } }