Link to home
Start Free TrialLog in
Avatar of DOT_NET
DOT_NET

asked on

XML data in ASP.NET

Hi

I have to create a FAQ page in ASP.NET
for example

i need to design the below format of header and listitems
where header is text and listeitems are hyperlinks

but i dont want to hard code Header or the listitems text or its Url's
i want all to be writen in XML file such that ASP.NET reads XML file and generates this output
later i can add/remove Header and URL from XML file




New to Programming   (header)
    o How to Start      (listitems)
    o What are the Requirements

Allready a member
    o How to renew my membership
    o What are the payment methods
.....
....
...
   

Please help me how to design the XML file structure and ASP.NET code which reads from it and displays in above format
Avatar of AerosSaga
AerosSaga

Avatar of DOT_NET

ASKER

can someone give me working sample
ASKER CERTIFIED SOLUTION
Avatar of diablocute
diablocute

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oops, i forgot to add one more  }
after headerString.Append("</ul>");
Here's another approach:  With your ASP.NET project open, click the Project menu in VS and select Add New Item.  Select the Dataset icon in the dialog and give the dataset a filename like FAQ.xsd.  You will get a blank yellowish designer.  In this designer, right click and select Add >> New Element.  You will get a box with two columns.  At the top the name will be element1.  Change this to Header.  Then add some columns that would belong to a Header table (if you had one).  The left column of the box is for the column name; the right for the data type.  Do the same thing and create a ListItems element.  Make sure the Header element has a field that will be a unique key to each Header.  Then make sure the ListItems element has a column that will reference the Header's key.  These elements are defined in an xml schema that ADO.NET uses to create an ADO.NET dataset with data tables for each of these elements.

After creating the elements for your Header and ListItems, right click the dataset designer and select Add >> New Relation.  This is where you join the two tables on the Header key.

Once you have done this, you can add this dataset to a page and add rows to the Header and ListItems data tables.  If you want to save this info as xml, you call the dataset's WriteXml() method, passing it a file name to write the xml to.  Conversely, if you want to read that xml back into the dataset, you call ReadXml(), passing it the file name.

John
what u can do is use an xslt file that define the html format of each element
and the use the xml control of the .net to load both the xml file and the xslt trasnformation
Avatar of DOT_NET

ASKER

Hi  diablocute
i'll try your code
and get back to u
thanks :)