Click here to Skip to main content
13,252,362 members (60,500 online)
Rate this:
Please Sign up or sign in to vote.
See more:
From poster tool i got the values from DB as xml tags how could i display in the form through gridview in front end????

TestService.Service wsTestService = new TestService.Service(); // form connected to webservice
XmlDocument document = new XmlDocument();
System.Xml.XmlNode newNode;
newNode = wsTestService.GetDataFromDB();
DataSet ds = new DataSet();
byte[] buf = System.Text.ASCIIEncoding.ASCII.GetBytes(newNode.OuterXml);
System.IO.MemoryStream ms = new System.IO.MemoryStream(buf);
dataGridView1.DataSource = ds.Tables[0];
string Msg = string.Empty;
int Suc;
string Role = "student";
wsTestService.FACULTIES_ONLINE( Role ,out document, out Msg, out Suc); // document is xml document how could i call it??
Posted 22-Apr-13 20:00pm
What do you mean by "calling a document"?
muhammed riyaaz 23-Apr-13 1:13am
how should i define the document as a gridview display inside the service parameters.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Display as XmlNode Node(object)

DataTable dt = new DataTable();
dt.Columns.Add("FirstName", typeof(string));
dt.Columns.Add("LastName", typeof(string));
dt.Columns.Add("UserName", typeof(string));
dt.Columns.Add("Role", typeof(string));
XmlDocument xmldoc = new XmlDocument();
XmlNodeList nodeList = xmldoc.SelectNodes("/users/user");
foreach (XmlNode node in nodeList)
DataRow dtrow = dt.NewRow();
dtrow["FirstName"] = node["FirstName"].InnerText;
dtrow["LastName"] = node["LastName"].InnerText;
dtrow["UserName"] = node["UserName"].InnerText;
dtrow["Role"] = node["Job"]["Role"].InnerText;
gvDetails.DataSource = dt;

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

Advertise | Privacy |
Web02 | 2.8.171114.1 | Last Updated 2 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100