1. 程式人生 > >[Asp.Net]4種方法把資料繫結到Dropdownlist

[Asp.Net]4種方法把資料繫結到Dropdownlist

public class ClassMonth
{
    private string _MonthEN = DateTime.Now.ToString("MMMM",System.Globalization.CultureInfo.CreateSpecificCulture("en"));
    private string _MonthCN = DateTime.Now.ToString("MMMM", System.Globalization.CultureInfo.CreateSpecificCulture("zh-CN"));
    public ClassMonth()
    {

        MonthCN = DateTime.Now.ToString("MMMM", System.Globalization.CultureInfo.CreateSpecificCulture("zh-CN"));
        MonthEN = DateTime.Now.ToString("MMMM", System.Globalization.CultureInfo.CreateSpecificCulture("en"));
    }

    

    public ClassMonth(string cn,string en)
    {
        MonthCN = cn;//匯入變數為屬性賦值
        MonthEN = en;//匯入變數為屬性賦值
        
    }

    public string MonthEN //構造屬性
    {
       get
        {
            return _MonthEN;

        }
        set
        {

            _MonthEN = value;

        }
        

       
    }
    public string MonthCN  //構造屬性
    {
        get
        {
            return _MonthCN;

        }
        set
        {

            _MonthCN = value;

        }


    }
}