Displaying XML Data using .Net Controls


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Displaying XML Data using .Net Controls

Hybrid View

  1. #1
    Greg Rothlander Guest

    Displaying XML Data using .Net Controls


    I'm looking for some suggestions on how to best display some simple XML data
    using .Net controls... or any other way that would work.

    What I'm doing is very simple. It's similar to registering for classes at
    a college. Say I'm registering for Biology, English, and Math. The XML
    might look like...

    <Classes>
    <Class>
    <Name>Biology</Name>
    <ID>1234</ID>
    <Days>MWF</Days>
    </Class>
    <Class>
    <Name>English</Name>
    <ID>5678</ID>
    <Days>TH</Days>
    </Class>
    <Class>
    <Name>Math</Name>
    <ID>9012</ID>
    <Days>M</Days>
    </Class>
    </Classes>

    And I want to display it like...

    Class ID Days
    --------- ------ ------
    Biology 1234 MWF
    English 5678 TH
    Math 9012 W

    Simple enough using a DataGrid and XML. But now we found out that the section
    of biology you tried to sign up for isn't available and we want to list the
    280 different biology class that are the same biology class but they are
    at different campuses and at different times. So because there are so many
    we do not want to list them all individually, but we want to group them into
    classes at each of say 20 different campuses.


    So you would see something like....

    Biology
    Math

    Then you select on Biology and you'd get....
    Biology
    Main Campus
    East Campus
    West Campus
    Math

    Then you select on Main Campus and you'd get...

    Biology
    Main Campus
    Section Time Day
    add 1234 12:00 - 1:00 MWF
    add 1234 12:00 - 1:00 TH
    add 1234 12:00 - 1:00 F

    East Campus
    West Campus
    Math

    Then you'd select the "add" hyperlink and you'd be registered for the class.
    Here is the full view of everything...

    Biology

    Main Campus
    Section Time Day
    add 1234 12:00 - 1:00 MWF
    add 1234 12:00 - 1:00 TH
    add 1234 12:00 - 1:00 F

    East Campus
    Section Time Day
    add 1234 12:00 - 1:00 MWF
    add 1234 12:00 - 1:00 TH
    add 1234 12:00 - 1:00 F

    West Campus
    Section Time Day
    add 1234 12:00 - 1:00 MWF
    add 1234 12:00 - 1:00 TH
    add 1234 12:00 - 1:00 F

    Math

    Main Campus
    Section Time Day
    add 1234 12:00 - 1:00 MWF
    add 1234 12:00 - 1:00 TH
    add 1234 12:00 - 1:00 F

    East Campus
    Section Time Day
    add 1234 12:00 - 1:00 MWF
    add 1234 12:00 - 1:00 TH
    add 1234 12:00 - 1:00 F

    West Campus
    Section Time Day
    add 1234 12:00 - 1:00 MWF
    add 1234 12:00 - 1:00 TH
    add 1234 12:00 - 1:00 F

    My first guess was to use a TreeView control to do this. That didn't look
    good and indentation was a problem. So then I move to LI and UL and turning
    off and on the visible property. That worked OK but it was very confusing
    once you got into the 3rd level so I look at DataGrid in .Net. That's a
    little more insteresting but not exactly what I wanted to I've been playing
    with DataList using the Template controls and I've just about got it to work.


    I can not get the Template to correctly translate the XML allthough I can
    get it to open and close correctly but I can only do this with hard-coded
    data. I can not figure out a good way to get the data out of XML and into
    the format I need. Maybe using XSL might be the answer.

    Any ideas? Any suggestion or samples would be very much apprecaited.

    Thanks for your time,
    Greg Rothlander


  2. #2
    Paul Mc Guest

    Re: Displaying XML Data using .Net Controls


    G'day Greg.

    >Any ideas? Any suggestion or samples would be very much apprecaited.


    The datagrid can consume ADO.NET datasets, which can, in turn, be loaded
    from XML; take a look at the ReadXml and ReadXmlSchema methods of the dataset
    object...

    Hope this helps,
    Cheers,
    Paul



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center