Fill year in dropdownlist using for loop
private void fill_ExpDate_Y_dropdown()
{
for (int i = DateTime.Now.Year ; i <= DateTime.Now.Year + 20; i++)
{
ddl_ExpDate_Y.Items.Add(new ListItem(i.ToString(), i.ToString()));
}
ddl_ExpDate_Y.Items.Insert(0, "---Select---");
}
{
for (int i = DateTime.Now.Year ; i <= DateTime.Now.Year + 20; i++)
{
ddl_ExpDate_Y.Items.Add(new ListItem(i.ToString(), i.ToString()));
}
ddl_ExpDate_Y.Items.Insert(0, "---Select---");
}
0 comments:
Post a Comment