protected void ddlMajorId_SelectedIndexChanged(object sender, EventArgs e) { ddlClassId.DataSource = ClassBLL.AllData(" and MajorId =" + ddlMajorId.SelectedValue, "ClassId", "asc"); ddlClassId.DataTextField = "ClassName"; ddlClassId.DataValueField = "ClassId"; ddlClassId.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindsTypes(); if (Request.QueryString["uid"] != null) { Sudents model = SudentsBLL.GetIdBySudents(Convert.ToInt32(Request.QueryString["uid"])); ddlGrade.SelectedValue = model.Grade.ToString(); ddlMajorId.SelectedValue = ClassBLL.GetIdByClass(model.ClassId).MajorId.ToString(); ddlClassId.DataSource = ClassBLL.AllData(" and MajorId =" + ddlMajorId.SelectedValue, "ClassId", "asc"); ddlClassId.DataTextField = "ClassName"; ddlClassId.DataValueField = "ClassId"; ddlClassId.DataBind(); ddlClassId.SelectedValue = model.ClassId.ToString(); ddlNational.SelectedValue = model.National.Trim(); ddlPolitical.SelectedValue = model.Political.Trim(); txtBorn.Value = model.Born.ToString("yyyy-MM-dd") != "1900-01-01" ? model.Born.ToString("yyyy-MM-dd") : ""; txtContact.Value = model.Contact.Trim(); txtNative.Value = model.Native.Trim(); txtNote.Value = model.Note.Trim(); txtPwd.Value = model.Pwd.Trim(); txtSutCode.Value = model.SutCode.Trim(); txtSutName.Value = model.SutName.Trim(); ddlSex.SelectedValue = model.Sex.Trim(); btnAdd.Text = "修改"; } } }
private void Binds() { ddlMajorId.DataSource = MajorBLL.AllData("", "MajorId", ""); ddlMajorId.DataTextField = "MajorName"; ddlMajorId.DataValueField = "MajorId"; ddlMajorId.DataBind(); rpView.DataSource = ClassBLL.AllData("", "ClassId", "asc"); rpView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlClassId.DataSource = ClassBLL.AllData("", "ClassId", ""); ddlClassId.DataTextField = "ClassName"; ddlClassId.DataValueField = "ClassId"; ddlClassId.DataBind(); ddlClassId.Items.Insert(0, new ListItem("全部", "0")); Binds(); } }
private void BindsTypes() { ddlMajorId.DataSource = MajorBLL.AllData("", "MajorId", "asc"); ddlMajorId.DataTextField = "MajorName"; ddlMajorId.DataValueField = "MajorId"; ddlMajorId.DataBind(); ddlClassId.DataSource = ClassBLL.AllData(" and MajorId =" + ddlMajorId.SelectedValue, "ClassId", "asc"); ddlClassId.DataTextField = "ClassName"; ddlClassId.DataValueField = "ClassId"; ddlClassId.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["Sudents"] != null) { sudents = (Sudents)Session["Sudents"]; } else { Response.Write("<script>parent.window.location.href='Login.aspx'</script>"); } if (!IsPostBack) { BindsTypes(); Sudents sud = SudentsBLL.GetIdBySudents(sudents.SutId); ddlGrade.SelectedValue = sud.Grade.ToString(); ddlMajorId.SelectedValue = ClassBLL.GetIdByClass(sud.ClassId).MajorId.ToString(); ddlClassId.DataSource = ClassBLL.AllData(" and MajorId =" + ddlMajorId.SelectedValue, "ClassId", "asc"); ddlClassId.DataTextField = "ClassName"; ddlClassId.DataValueField = "ClassId"; ddlClassId.DataBind(); ddlClassId.SelectedValue = sud.ClassId.ToString(); ddlNational.SelectedValue = sud.National.Trim(); ddlPolitical.SelectedValue = sud.Political.Trim(); txtBorn.Value = sud.Born.ToString("yyyy-MM-dd") != "1900-01-01" ? sud.Born.ToString("yyyy-MM-dd") : ""; txtContact.Value = sud.Contact.Trim(); txtNative.Value = sud.Native.Trim(); txtNote.Value = sud.Note.Trim(); lblSutCode.Text = sud.SutCode.Trim(); txtSutName.Value = sud.SutName.Trim(); ddlSex.SelectedValue = sud.Sex.Trim(); lblPwd.Text = sud.Pwd.Trim(); } }