protected void GetYear()
        {
            string sql = "SELECT DISTINCT CNJG_YEAR  FROM TBTM_CNJG";

            System.Data.DataTable dt = DBCallCommon.GetDTUsingSqlText(sql);
            DropDownListYear.DataTextField  = "CNJG_YEAR";
            DropDownListYear.DataValueField = "CNJG_YEAR";
            DropDownListYear.DataSource     = dt;
            DropDownListYear.DataBind();

            for (int k = 1; k <= 12; k++)
            {
                string j = k.ToString() + "月";
                if (k < 10)
                {
                    j = "0" + k.ToString() + "月";
                }
                DropDownMonth.Items.Add(new ListItem(j.ToString(), j.ToString()));
            }
            DropDownMonth.Items.Insert(0, new ListItem(" ", " "));
        }
Beispiel #2
0
 public void bindYear()
 {
     try
     {
         SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["UniversityDatabaseConnectionString"].ConnectionString);
         con.Open();
         DataTable      dt  = new DataTable();
         SqlCommand     cmd = new SqlCommand("Select Distinct YEAR from TESTING$", con);
         SqlDataAdapter da  = new SqlDataAdapter(cmd);
         da.Fill(dt);
         con.Close();
         DropDownListYear.DataSource     = dt;
         DropDownListYear.DataValueField = "YEAR";
         DropDownListYear.DataBind();
         DropDownListYear.Items.Insert(0, new ListItem("Select", ""));
     }
     catch (Exception ee)
     {
         Response.Write("<script>alert('Error While Binding Year!!');</script>");
     }
 }
Beispiel #3
0
 private void fillDdl()
 {
     DropDownListYear.DataSource = System.Linq.Enumerable.Range(1940, 79);
     DropDownListYear.DataBind();
 }
Beispiel #4
0
 //Funció per a reomplir el dropdownlist de l'any
 protected void fillDdl()
 {
     DropDownListYear.DataSource = Enumerable.Range(1940, 79);
     DropDownListYear.DataBind();
 }