System.Globalization.DateTimeFormatInfo.GetMonthName C# (CSharp) Méthode

GetMonthName() public méthode

Returns the culture-specific full name of the specified month based on the culture associated with the current DateTimeFormatInfo object.
public GetMonthName ( int month ) : string
month int An integer from 1 through 13 representing the name of the month to retrieve.
Résultat string
        public extern string GetMonthName(int month);

Usage Example

    protected void Page_Load(object sender, EventArgs e)
    {
        objCommonMIS.BusinessLine_Sno = "2";
        objCommonMIS.EmpId            = Membership.GetUser().UserName.ToString();

        if (!Page.IsPostBack)
        {
            objCommonMIS.GetAllRegions(ddlRegion);
            objCommonMIS.RegionSno = "0";
            objCommonMIS.BranchSno = "0";

            objCommonMIS.GetUserProductDivisions(ddlProductDivision);

            // Bhawesh added 1 March 13
            for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 2; i--)
            {
                DDlYear.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }

            for (int i = 1; i <= 12; i++)
            {
                DDLMonth1.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString()));
                DDLMonth2.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString()));
            }
            DDLMonth1.Items.Insert(0, new ListItem("Select", "0"));
            DDLMonth2.Items.Insert(0, new ListItem("Select", "0"));
            ddlRegion.Items[0].Text          = "Select";
            ddlProductDivision.Items[0].Text = "Select";
        }
    }
All Usage Examples Of System.Globalization.DateTimeFormatInfo::GetMonthName