Search This Blog

Tuesday, April 19, 2011

Bind Year in C#


#region BINDYEAR
    private void BINDYEAR()
    {
        try
        {
            int A = 1800;
            for (int i = 0; i < 20; i++)
            {
                ListItem LI = new ListItem();
                LI.Text = Convert.ToInt16(A).ToString();
                LI.Value = A.ToString();
                A=A+1;
                ddl_year.Items.Add(LI);
            }
            ddl_year.Items.Insert(0, "YYYY");
              
        }
        catch (Exception errmsg)
        {
            Response.Write(errmsg.Message.ToString());
        }
    }
    #endregion

No comments :