473,398 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

C#-WEB: displaying XML file

working with Microsoft Visual studio 2005, in C# and making a website.

my problem is simple, but for the life of me I cannot solve it. apparently I miss the brain connection for this specific problem because regardless of the multiple tutorials and howtos out there, I cannot seem to do it.

Okay, I need to display the contents of an XML file.
The xml file itself is made dynamically, but that shouldn't matter. the file is made, and the code I've written should read the xml file.

Label7.Text += "test: getting in the try function </br>";
XmlDataSource1.DataFile = Server.MapPath("userInfo.xml");
XmlDataSource1.DataBind();
DataList1.DataSourceID = "XmlDataSource1";
DataList1.DataBind();

this is the code that I believe should do the trick. I've tried litterally tens of other ways but none of them seem to work. this also doesn't work, but the reason I believe this might work is because if I in the aspx page manually set the datalist's datasource as XmlDataSource 1, and then when configuring the datasource, I can choose userInfo.xml, and voila, it shows a very small, very illogical part of the xml file. this of course is a succes, but I need to do it with c#.

I've tried repeaters, datagrids, textboxes, and nothing worked. I deleted the XmlDatasource, and just gave the xml file to the datalist, and it didn't work, I've made a testpage with just one function, to show the bloody xml file... and it didn't work... I asked my teacher, but she's slow, and I desperatly need to know how (getting all emotional now - really, I'm on the verge of crying. something so awfully simple and whatever I do, it doesn't work. aargh)
Nov 26 '07 #1
3 1397
kenobewan
4,871 Expert 4TB
Expand|Select|Wrap|Line Numbers
  1.             XmlDataSource1.DataFile = Server.MapPath("userInfo.xml");
  2.             DataList1.DataSource = "XmlDataSource1";
  3.             DataList1.DataBind();
  4.  
What happens if you do this? Nice ploy trying for the sympathy vote, suggest leaving off the emotional part next time or we might think that you are unsuited to programming ;).
Nov 27 '07 #2
I'm unsuited for programming alright. thing is that teachers generally don't accept that. I once tried that when having to program threads in java. I told my teacher at my exam I was not fit for this... I think that comment got my grade even lower. (why then follow a computer orientated course... guess I wanna finish what I started - that and programming ain't all that bad. ( like C# for example)).

Anyway, sorry for all the emotion. the deadline is nearing and I can't get through this stupid thing.

but, it didn't work. tried it without succes.
thanks for replying though.

I got my teacher to give me some kind of hint though. she tells me to use a Dataset, an Xmlreader and an Xmlwriter.
Nov 28 '07 #3
kenobewan
4,871 Expert 4TB
Great now she has pointed you in the right direction, you won't need our help. Good luck!
Nov 29 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ben | last post by:
Hi all, i have file input field in a form like this: <input name="isbn" type="text" size="25" value="<?php echo $_POST ?>" /> <input name="image" type="file" size="25" value="<?php echo...
24
by: Mark Sargent | last post by:
Hi All, response.write FilePath gives this path, ImageName.jpeg but the image(s) doesn't display in the below code. What am I missing..? Cheers. <%Response.Write FilePath%> Original...
1
by: sam.collett | last post by:
Is there a basic guide on Xml document creation and editing (simpler than the MSDN docs). Say I want to create a file containing the following: <?xml version="1.0" encoding="utf-8"...
8
by: Sam Collett | last post by:
Is there a basic guide on Xml document creation and editing (simpler than the MSDN docs). Say I want to create a file containing the following: <?xml version="1.0" encoding="utf-8"...
1
by: Rukmal Fernando | last post by:
Hi all, I have a file retrieved from a database and I want to return it over a web page. I currently have an ASPX page (Download.aspx) with code similar to the following in Page_Load(): ...
2
by: shakthi | last post by:
Hi all, Got good response and solution for my previous posts.Thanks a lot to sudhir and sivadass.Now i have one more doubt.I WANT TO DISPLAY THE CONTENTS OF A FILE THAT IS PLACED IN AN...
0
by: =?Utf-8?B?c2NvdHRybQ==?= | last post by:
I have a button on a web page that retrieves some binary data (a word document) from a database as a stream and writes it to a web page. This is working ok, only problem is when someone clicks...
1
by: maspr | last post by:
I am exporting a GridView to Excel in ASP.NET 2.0 with no problems. However, a user is getting the File Download dialog box twice when she exports, but for other users it only fires once. Does anyone...
3
by: BW | last post by:
We have a directory on our network where we keep pictures for all of our customers. They utilize a directory structure to keep them organized. I would like to have the clients be able to log onto...
3
by: shashi shekhar singh | last post by:
Thanx you very much for your support Sir Frinavelle Respected Sir, Is it possible to call directory.getfiles("path","filename"); Question : I would like to call files i.e. stored on local hdd...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.