Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Illegal characters in path.

Line 25: //doc.Load(Server.MapPath("~//xml_file//my_xml.xml"));
Line 26: doc.Load(@"D:\my_xml.xml");
Line 27: ds.ReadXml(new System.IO.StreamReader(doc.OuterXml));
Line 28: GridView1.DataSource = ds;
Line 29: GridView1.DataBind();





plz help me....

i have try string to object
string xmldata = Server.MapPath("~/") + "my_xml.xml";
doc.Load(xmldata);
ds.ReadXml(new System.IO.StreamReader(doc.OuterXml));
GridView1.DataSource = ds;
GridView1.DataBind();


--------------
but error
Illegal characters in path.
Posted
Comments
Shahriar Iqbal Chowdhury/Galib 17-Nov-10 9:04am    
Do You really know where is your file ? very First line you are trying to load from "~//xml_file//my_xml.xml" this location and then at last part of post you are trying "~/my_xml.xml". First locate where you actually put your xml file. btw try this
doc.Load(Server.MapPath(@"~/xml_file/my_xml.xml"))
this should work.

1 solution

Bind the grid to the DataTable in the DataSet, not the DataSet itself.
GridView1.DataSource = ds.Tables[0];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900