I won't be surprised if someone can look at this and point out the problem right away, but I'm also ashamed to say how long I've been looking at it and trying to make it work...
private void Page_Load(object sender, System.EventArgs e) {
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("id",typeof(int)));
dt.Columns.Add(new DataColumn("name",typeof(string)));
DataRow dr = dt.NewRow();
dr["id"] = 6;
dr["name"] = "City1";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["id"] = 7;
dr["name"] = "City2";
dt.Rows.Add(dr);
this.ddLabList.DataSource = dt;
this.ddLabList.DataTextField = "name";
this.ddLabList.DataValueField = "id"; this.ddLabList.DataBind();
}
The this.ddLabList.DataSource = dt; line gives an 'Object reference not set to an instance of an object' error.
Help!