Need help with XML and DropDownList box
I'm trying to bind an XML file containing a list of books to a Drop Down List box and can't make it work. Here is the code:
void Page_Load(){
DataSet dataSet = new DataSet();
dataSet.ReadXml(Server.MapPath("books.xml"));
ArrayList myArrayList = new ArrayList();
foreach(DataRow item in dataSet.Tables[0].Rows){
myArrayList.Add(item);
}
ddlBooks.DataSource=myArrayList;
ddlBooks.DataBind();
The DropDownList box fills with System.Data.DataRow.
|