publicclass NestedDataLists : System.Web.UI.Page { protected System.Web.UI.WebControls.DataList dlCategories; privatevoid Page_Load(object sender, System.EventArgs e) { string constring=System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]; DataSet ds=new DataSet(); string sql1="select * from province"; SqlDataAdapter sda1 =new SqlDataAdapter(sql1,constring); sda1.Fill(ds,"province"); string sql2="select * from city"; SqlDataAdapter sda2 =new SqlDataAdapter(sql2,constring); sda2.Fill(ds,"city"); ds.Relations.Add("myrelation", ds.Tables["province"].Columns["provinceID"], ds.Tables["city"].Columns["father"]); dlCategories.DataSource=ds.Tables["province"].DefaultView; dlCategories.DataBind(); } Web Form Designer generated code#region Web Form Designer generated code overrideprotectedvoid OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /**////<summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. ///</summary> privatevoid InitializeComponent() { this.Load +=new System.EventHandler(this.Page_Load); } #endregion }