HI, i'm kinda new to ASP.NET and must do a project including webservices and a client site so i already made the webservice wich outputs strings in XML format now i want that string to be binded to a datagrid, does anyone know how i can do this? I created this
in my aspx page : protected DataGrid DG; private void Page_Load(object sender, System.EventArgs e) { wsProduct.Product myservice = new wsProduct.Product(); //the proxy to the webservice string cataloog = myservice.getCatalogue(); //retrieve webmethod and put
the xml in string DataSet mydataset = new DataSet(); mydataset.ReadXml(cataloog); // here i got the problem DG.DataSource = mydataset.Tables[0].DefaultView; DG.DataBind(); } Ok, ReadXml think "cataloog" is a file, so i get the follwing error : Exception Details:
System.IO.PathTooLongException: The path is too long after being fully qualified. Make sure path is less than 260 characters. I searched on this forum about possible solution, but couldn't find it Does anyone have a possible one? Thanks in advance
DataSet doesn't have a function that interprets a string as an XML stream, but it
does have a ReadXml() overload that takes a TextReader, so just use the StringReader implementation:
protected DataGrid DG;
private void Page_Load(object sender, System.EventArgs e)
{
wsProduct.Product myservice = new wsProduct.Product(); //the proxy to the webservice
string cataloog = myservice.getCatalogue(); //retrieve webmethod and put the xml in string
DataSet mydataset = new DataSet();
mydataset.ReadXml(new StringReader(cataloog)); // here i got the problem
DG.DataSource = mydataset.Tables[0].DefaultView;
DG.DataBind();
}
Bluelove
Member
40 Points
8 Posts
ReadXml problem
Sep 30, 2003 08:23 PM|LINK
russnem
Contributor
7001 Points
1389 Posts
ASPInsiders
MVP
Re: ReadXml problem
Sep 30, 2003 08:29 PM|LINK
Bluelove
Member
40 Points
8 Posts
Re: ReadXml problem
Sep 30, 2003 08:37 PM|LINK
Ryan Milliga...
Participant
1057 Points
210 Posts
Re: ReadXml problem
Oct 01, 2003 04:41 AM|LINK
protected DataGrid DG; private void Page_Load(object sender, System.EventArgs e) { wsProduct.Product myservice = new wsProduct.Product(); //the proxy to the webservice string cataloog = myservice.getCatalogue(); //retrieve webmethod and put the xml in string DataSet mydataset = new DataSet(); mydataset.ReadXml(new StringReader(cataloog)); // here i got the problem DG.DataSource = mydataset.Tables[0].DefaultView; DG.DataBind(); }-- Ryan MilliganBluelove
Member
40 Points
8 Posts
Re: ReadXml problem
Oct 01, 2003 01:07 PM|LINK