コード例 #1
0
    protected override void OnInit(EventArgs e)
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
        base.OnInit(e);
        int i;

        for (i = 1; i <= 31; i++)
        {
            ddlDay.Items.Add(new ListItem(clsDefault.Right("0" + i.ToString(), 2), i.ToString()));
        }
        for (i = 1; i <= 12; i++)
        {
            ddlMonth.Items.Add(new ListItem(clsDefault.MonthName(i), i.ToString()));
        }
        for (i = DateTime.Now.AddYears(-60).Year; i <= DateTime.Now.AddYears(10).Year; i++)
        {
            ddlYear.Items.Add(i.ToString());
        }
        ddlDay.Items.Insert(0, new ListItem("-", "null"));
        ddlMonth.Items.Insert(0, new ListItem("-", "null"));
        ddlYear.Items.Insert(0, new ListItem("-", "null"));

        ddlDay.SelectedValue   = DateTime.Now.Day.ToString();
        ddlMonth.SelectedValue = DateTime.Now.Month.ToString();
        ddlYear.SelectedValue  = DateTime.Now.Year.ToString();
    }
コード例 #2
0
    protected override void OnInit(EventArgs e)
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
        base.OnInit(e);
        int i;

        for (i = 1; i <= 31; i++)
        {
            ddlDay.Items.Add(new ListItem(clsDefault.Right("0" + i.ToString(), 2), i.ToString()));
        }
        for (i = 1; i <= 12; i++)
        {
            ddlMonth.Items.Add(new ListItem(clsDefault.MonthName(i), i.ToString()));
        }
        for (i = DateTime.Now.AddYears(-60).Year; i <= DateTime.Now.AddYears(10).Year; i++)
        {
            ddlYear.Items.Add(i.ToString());
        }
        for (i = 0; i < 24; i++)
        {
            ddlHour.Items.Add(new ListItem(clsDefault.Right("0" + i.ToString(), 2), i.ToString()));
        }
        for (i = 0; i < 60; i++)
        {
            ddlMinute.Items.Add(new ListItem(clsDefault.Right("0" + i.ToString(), 2), i.ToString()));
        }
        ddlDay.Items.Insert(0, new ListItem("-", "null"));
        ddlMonth.Items.Insert(0, new ListItem("-", "null"));
        ddlYear.Items.Insert(0, new ListItem("-", "null"));
        ddlHour.Items.Insert(0, new ListItem("-", "null"));
        ddlMinute.Items.Insert(0, new ListItem("-", "null"));

        ddlDay.SelectedValue    = DateTime.Now.Day.ToString();
        ddlMonth.SelectedValue  = DateTime.Now.Month.ToString();
        ddlYear.SelectedValue   = DateTime.Now.Year.ToString();
        ddlHour.SelectedValue   = DateTime.Now.Hour.ToString();
        ddlMinute.SelectedValue = DateTime.Now.Minute.ToString();

        chkEnable.Attributes.Add("onclick", "UserControlChecker_" + this.ClientID + "()");
    }