Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2004, 05:47 PM
Registered User
 
Join Date: May 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to waru
Default 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.

 
Old May 27th, 2004, 06:05 PM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cairo, , Egypt.
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000
Default

to complete filling the dropdown list you have to do so>>
    ddlBooks.DataSource=myArrayList;
ddlBooks.textfield="Bookname"
    ddlBooks.valuefield="Bookid"

    ddlBooks.DataBind();

Ahmed Ali
Software Developer
 
Old May 27th, 2004, 06:23 PM
Registered User
 
Join Date: May 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to waru
Default

Thanks but that doesn't work. I'm getting the message:
'System.Web.UI.WebControls.DropDownList' does not contain a definition for 'valuefield'and exacly the same for textfield.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
Sort XML in dropdownlist Hughesie78 XSLT 1 November 23rd, 2007 08:41 AM
Read data from XML then load it into combo box edizone XML 4 October 4th, 2006 05:11 AM
Dropdownlist box arnniema Classic ASP Basics 1 November 14th, 2005 06:13 PM
select box/List box alphabetic sort sasidhar79 Javascript How-To 3 November 10th, 2004 03:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.