Dear sir, the below algorithm is working fine. for the XML File as below. but according to requirement no use dataset. so i have created the above algorithm as follows but looping not happening.because index like row[i][0] not there. <?xml version="1.0"?> -<DocumentElement> -<test> <c0>manas</c0> <c1>100</c1> <c2>20</c2> <c3>33</c3> <c4>54</c4> <c5>65</c5> <c6>78</c6> </test> -<test> <c0>manasi</c0> <c1>101</c1> <c2>25</c2> <c3>76</c3> <c4>90</c4> <c5>12</c5> <c6>74</c6> </test> -<test> <c0>mani</c0> <c1>115</c1> <c2>29</c2> <c3>56</c3> <c4>11</c4> <c5>95</c5> <c6>78</c6> </test> </DocumentElement> static void GetXmlValue(int NoOfColumn) { XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(@"D:\Prod.xml"); XmlNode nodeCol = xmldoc.DocumentElement.FirstChild; XmlNode nodeRow = xmldoc.DocumentElement; XmlNodeList lstRows = nodeRow.ChildNodes; XmlNodeList lstColumns = nodeCol.ChildNodes; for (int i = 0; i < lstRows.Count; i++) { string names = lstColumns[i].InnerText.ToString(); if (i > 0) Response.Write("<br/>"); string lines = names + " "; for (int j = 1; j < lstColumns.Count; j++) //Check with no of columns { lines += lstColumns[j].InnerText.ToString() + " "; if (j % NoOfColumn == 0)//When it is equla with your no of columns upto last stage { Response.Write("<br/>"); lines = names + " "; } if (j == lstColumns.Count - 1 && j % NoOfColumn != 0) //Check at last column { Response.Write(lines + "<br/>"); } } } } now the output is like: manas 100 20 33 54 manas 65 78 .. .. correct for first row 100 100 20 33 54 100 65 78 ... ... 20 100 20 33 54 20 65 78 ... ...
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)