ArrayList list = new ArrayList();
SPSite site = new SPSite("http://amid01110/");
SPWeb web = site.RootWeb;
foreach (SPList ls in web.Lists)
{
//Page.Response.Write(ls.Title + "<br/>");//获取后显示在页面上
list.Add(ls.Title);//将数据保存list中
}
dwlist.DataSource = list;//绑定
dwlist.DataBind();//绑定
web.Dispose();
site.Dispose();
不用ArrayList也可以
ListItemCollection LIColl = new ListItemCollection(); ArrayList list = new ArrayList(); SPSite site = new SPSite("http://amid01110/"); SPWeb web = site.RootWeb; foreach (SPList ls in web.Lists) { //Page.Response.Write(ls.Title + "<br/>");//获取后显示在页面上 LIColl.Add(ls.Title);//将数据保存list中 } dwlist.DataSource = LIColl;//绑定 dwlist.DataBind();//绑定 web.Dispose(); site.Dispose();