protected void Page_Load(object sender, EventArgs e) { DdlProject.DataSource = Lib.DBHelper.createDDLView("select project_id,project_id||' ' ||name project_des from ifsapp.project@erp_prod where probability_to_win <> 1"); DdlProject.DataTextField = "project_des"; DdlProject.DataValueField = "project_id"; DdlProject.DataBind(); }
private void BindProject() { DataTable dtProject = new DataTable(); Project project = new Project(); dtProject = project.GetProject(); DdlProject.DataSource = dtProject; DdlProject.DataTextField = "ProjectName"; DdlProject.DataValueField = "ProjectId"; DdlProject.DataBind(); DdlProject.Items.Insert(0, new ListItem("-----Select-----", string.Empty)); }
protected void Page_Load(object sender, EventArgs e) { String connString = getConnectionString(); conn = new MySqlConnection(connString); //get last update time conn.Open(); queryStr = ""; queryStr = "SELECT peer_date FROM webappdemo.updatedate"; cmd = new MySqlCommand(queryStr, conn); MySqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { LastUpdateTime.Text = (reader["peer_date"].ToString()); } conn.Close(); if (!IsPostBack) { //bind ddlproject conn.Open(); queryStrProject = ""; queryStrProject = "SELECT * FROM webappdemo.projects"; cmd = new MySqlCommand(queryStrProject, conn); DdlProject.DataSource = cmd.ExecuteReader(); DdlProject.DataTextField = "ProjectName"; DdlProject.DataValueField = "ProjectID"; DdlProject.DataBind(); conn.Close(); DdlProject.Items.Insert(0, new ListItem("--Select Project--", "0")); //bind DdlCompetency DdlCompetency.AppendDataBoundItems = true; conn.Open(); queryStrCompetency = ""; queryStrCompetency = "SELECT * FROM webappdemo.competency"; cmd = new MySqlCommand(queryStrCompetency, conn); DdlCompetency.DataSource = cmd.ExecuteReader(); DdlCompetency.DataTextField = "Competency"; DdlCompetency.DataValueField = "Competency"; DdlCompetency.DataBind(); conn.Close(); DdlCompetency.Items.Insert(0, new ListItem("--Select Competency--", "0")); BindGrid(); } }