protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DDLYear.DataBind(); } }
private void BindFinyear() { DDLYear.DataSource = GetFinYear(DateTime.Now.ToString()); DDLYear.DataTextField = GetFinYear(DateTime.Now.ToString()).Columns["txt"].ToString(); DDLYear.DataValueField = GetFinYear(DateTime.Now.ToString()).Columns["val"].ToString(); DDLYear.DataBind(); DDLYear.Items.Insert(0, "Select"); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DDLYear.DataBind(); string ID = Request.Params["id"]; if (ID != null) { XmlDocument doc = new XmlDocument(); try { doc.Load(Server.MapPath("~") + "/Movies.xml"); XmlElement root = doc.DocumentElement; XmlNode movie = root.SelectSingleNode("/moviestore/movie[@ID=" + ID + "]"); DDLYear.SelectedValue = movie.Attributes["year"].Value; TBGenre.Text = movie.Attributes["genre"].Value; TBDuration.Text = movie.Attributes["duration"].Value; XmlNode title = movie.SelectSingleNode("title"); TBTitle.Text = title.InnerText; XmlNode director = movie.SelectSingleNode("director"); TBDirector.Text = director.InnerText; XmlNodeList actors = movie.SelectNodes("actor"); if (actors.Count > 0) { TBActor1.Text = actors[0].InnerText; } if (actors.Count > 1) { TBActor2.Text = actors[1].InnerText; } if (actors.Count > 2) { TBActor3.Text = actors[2].InnerText; } } catch (Exception ex) { } } } }
private void Grade() { LearnSite.BLL.TermTotal tbll = new LearnSite.BLL.TermTotal(); DDLYear.DataSource = tbll.TyearList(); DDLYear.DataTextField = "Tyear"; DDLYear.DataValueField = "Tyear"; DDLYear.DataBind(); LearnSite.BLL.Room room = new LearnSite.BLL.Room(); DDLgrade.DataSource = room.GetAllGrade(); DDLgrade.DataTextField = "Rgrade"; DDLgrade.DataValueField = "Rgrade"; DDLgrade.DataBind(); DDLclass.DataSource = room.GetClass(); DDLclass.DataTextField = "Rclass"; DDLclass.DataValueField = "Rclass"; DDLclass.DataBind(); }
private void Grade() { LearnSite.BLL.TermTotal tbll = new LearnSite.BLL.TermTotal(); DDLYear.DataSource = tbll.TyearList(); DDLYear.DataTextField = "Tyear"; DDLYear.DataValueField = "Tyear"; DDLYear.DataBind(); LearnSite.BLL.Room room = new LearnSite.BLL.Room(); DDLgrade.DataSource = room.GetAllGrade(); DDLgrade.DataTextField = "Rgrade"; DDLgrade.DataValueField = "Rgrade"; DDLgrade.DataBind(); DDLgrade.SelectedIndex = 0; DDLclass.DataSource = room.GetLimitClass(Int32.Parse(DDLgrade.SelectedValue)); DDLclass.DataTextField = "Rclass"; DDLclass.DataValueField = "Rclass"; DDLclass.DataBind(); }
private void showSgrade() { LearnSite.BLL.TermTotal tbll = new LearnSite.BLL.TermTotal(); DDLYear.DataSource = tbll.TyearList(); DDLYear.DataTextField = "Tyear"; DDLYear.DataValueField = "Tyear"; DDLYear.DataBind(); LearnSite.BLL.Room room = new LearnSite.BLL.Room(); CBgrades.DataSource = room.GetAllGrade().Tables[0]; CBgrades.DataTextField = "Rgrade"; CBgrades.DataValueField = "Rgrade"; CBgrades.DataBind(); int count = CBgrades.Items.Count; for (int i = 0; i < count; i++) { CBgrades.Items[i].Selected = true; } }
/// <summary> /// Initialize the drop down controls. /// </summary> public void Initialize() { DBAccess MonthYear = new DBAccess(); MonthYear.CommandText = "dbo.MonthYear"; DataSet DDLData = MonthYear.ExecuteDataSet(); //Bind DDLMonth DDLMonth.DataSource = DDLData; DDLMonth.DataMember = DDLData.Tables[0].TableName; DDLMonth.DataValueField = "ID"; DDLMonth.DataTextField = "Month"; DDLMonth.DataBind(); //Bind DDLYear DDLYear.DataSource = DDLData; DDLYear.DataMember = DDLData.Tables[1].TableName; DDLYear.DataValueField = "Year"; DDLYear.DataTextField = "Year"; DDLYear.DataBind(); PlaceHolder1.Controls.Clear(); Panel1.Visible = true; Panel2.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { DDLYear.DataBind(); }
protected void ReBindLists() { //Add several overrides to prevent massive page gets (limit list items returned) //This should but does not yet limit to valid options, if all fields are specified options should be current selections or blanks Dictionary <string, string> Queries = new Dictionary <string, string>(); if ((DDLMfg.SelectedIndex > 0) && (DDLMfg.SelectedValue != null)) { Queries.Add("manufacturer", DDLMfg.SelectedValue); } if ((DDLCardNumber.SelectedIndex > 0) && (DDLCardNumber.SelectedValue != null) && (DDLCardNumber.SelectedValue != "Too many results")) { Queries.Add("number", DDLCardNumber.SelectedValue); } if ((DDLPlayerName.SelectedIndex > 0) && (DDLPlayerName.SelectedValue != null) && (DDLPlayerName.SelectedValue != "Too many results")) { Queries.Add("name", DDLPlayerName.SelectedValue); } if ((DDLYear.SelectedIndex > 0) && (DDLYear.SelectedValue != null)) { Queries.Add("year", DDLYear.SelectedValue); } DataTable Values = new DataTable(); string value = null; value = DDLMfg.SelectedValue; Values = queryResult.PopFields("manufacturer", Queries); Values.Rows.InsertAt(Values.NewRow(), 0); if (Values.Rows.Count <= 100) { DDLMfg.DataSource = Values; DDLMfg.DataValueField = "manufacturer"; DDLMfg.Items.Clear(); DDLMfg.DataBind(); } else { DDLMfg.Items.Add("Too many results"); DDLMfg.DataBind(); } try { DDLMfg.SelectedValue = value; } catch { } value = DDLYear.SelectedValue; Values = queryResult.PopFields("year", Queries); Values.Rows.InsertAt(Values.NewRow(), 0); if (Values.Rows.Count <= 100) { DDLYear.DataSource = Values; DDLYear.DataValueField = "year"; DDLYear.Items.Clear(); DDLYear.DataBind(); } else { DDLYear.Items.Add("Too many results"); DDLYear.DataBind(); } try { DDLYear.SelectedValue = value; } catch { } value = DDLPlayerName.SelectedValue; Values = queryResult.PopFields("name", Queries); Values.Rows.InsertAt(Values.NewRow(), 0); if (Values.Rows.Count <= 500) { DDLPlayerName.DataSource = Values; DDLPlayerName.DataValueField = "name"; DDLPlayerName.Items.Clear(); DDLPlayerName.DataBind(); } else { DDLPlayerName.Items.Clear(); DDLPlayerName.Items.Add("Too many results"); DDLPlayerName.DataBind(); } try { DDLPlayerName.SelectedValue = value; } catch { } value = DDLCardNumber.SelectedValue; Values = queryResult.PopFields("number", Queries); Values.Rows.InsertAt(Values.NewRow(), 0); if (Values.Rows.Count <= 500) { DDLCardNumber.DataSource = Values; DDLCardNumber.DataValueField = "number"; DDLCardNumber.Items.Clear(); DDLCardNumber.DataBind(); } else { DDLCardNumber.Items.Clear(); DDLCardNumber.Items.Add("Too many results"); DDLCardNumber.DataBind(); } try { DDLCardNumber.SelectedValue = value; } catch { } ReBindGrid(); }