Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (DDL_MM.Items.Count == 0)    // not init yet
                {
                    MyPage.initDateForm(TXT_DD, DDL_MM, TXT_YY);
                }
                string       code;
                TextBox      tmpDD, tmpYY;
                DropDownList tmpMM;
                tmpDD = (TextBox)FindControl("TXT_DD");
                tmpMM = (DropDownList)FindControl("DDL_MM");
                tmpYY = (TextBox)FindControl("TXT_YY");

                code = "if(!numbersonly()) return false; if (this.value<=0 || this.value >31) this.value = this.value.substr(0,this.value.length-1);";
                tmpDD.Attributes.Add("onkeyup", code);
                tmpDD.Attributes.Add("onkeydown", code);
                code = "if(!numbersonly()) return false; if (this.value <= 0) this.value = this.value.substr(0,this.value.length-1);";
                tmpYY.Attributes.Add("onkeyup", code);
                tmpYY.Attributes.Add("onkeydown", code);

                string date_code;
                date_code = "displayDatePicker('" + tmpDD.ClientID + "/" + tmpMM.ClientID + "/" + tmpYY.ClientID + "',this.name,this);";
                IB_DATE.Attributes.Add("onclick", date_code);
            }
        }
Esempio n. 2
0
 protected override void OnPreRender(EventArgs e)
 {
     base.OnPreRender(e);
     if (DDL_MM.Items.Count == 0)        // not init yet
     {
         MyPage.initDateForm(TXT_DD, DDL_MM, TXT_YY);
     }
 }
Esempio n. 3
0
 public void setDate(DateTime date)
 {
     try
     {
         MyPage.initDateForm(TXT_DD, DDL_MM, TXT_YY);
         TXT_DD.Text          = date.Day.ToString();
         DDL_MM.SelectedValue = date.Month.ToString();
         TXT_YY.Text          = date.Year.ToString();
     }
     catch { ClearDate(); }
 }
Esempio n. 4
0
 public void setDate(string date)
 {
     try
     {
         DateTime tmp = DateTime.Parse(date);
         MyPage.initDateForm(TXT_DD, DDL_MM, TXT_YY);
         TXT_DD.Text          = tmp.Day.ToString();
         DDL_MM.SelectedValue = tmp.Month.ToString();
         TXT_YY.Text          = tmp.Year.ToString();
     }
     catch { ClearDate(); }
 }