以一个实例说明
//录入年份绑定 public void YearList(FineUIPro.DropDownList ddlYear)
{
//年份从15年到当前年//起止年份
int yearStart = ;
int yearEnd = DateTime.Now.Year.ToString().ToInt();//当前年份
//往Datatable中添加新行的步骤主要有
// 第一,声明一个Datatable;
// 第二,向Datatable中添加列;
// 第三,向Datatable中添加行 //①声明一个dataTable
DataTable Year = new DataTable();
//②添加列
Year.Columns.Add("Value",typeof(int));
Year.Columns.Add("Name",typeof(string)); //③添加行
for (int i = ; i< yearEnd- yearStart+; i++)
{
DataRow row = Year.NewRow();
int value = yearStart + i;
string name= (yearStart + i).ToString(); object[] objs = { value, name};
//dr.ItemArray = objs;
row["Value"] = objs[];
row["Name"] = objs[];
Year.Rows.Add(row.ItemArray); }
ddlYear.DataSource = Year;
ddlYear.DataTextField = "Name";
ddlYear.DataValueField = "Value";
ddlYear.DataBind();
}