XmlNodeList nodes = dom.SelectNodes(string.Format("/root/netstation[@id={0}]/devicetype[@id={1}]/device[@id={2}]/*", txtStation.Text, txtDevicetype.Text, txtDevice.Text));
if (nodes != null)
{
for (int i = 0; i < nodes.Count; i++)
{
sid += nodes[i].Attributes["id"].InnerText;
sval+= nodes[i].Attributes["value"].InnerText;
}
DataTable dt = new DataTable();
dt.Columns.Add("ID");
dt.Columns.Add("Value");
dt.Rows.Add(new object[] { sid, sval });
GridView1.DataSource = dt.DefaultView;
GridView1.DataBind();
}
else
{
Response.Write("<script>alert('没有此设备!');</script>");
clean();
}
显示结果很郁闷:
都到一行去了,本来是有两个ID,分别是1和2,value分别是sss和ddd
怎样使使他们不在一行