I am very New in C# so please don't mind if I ask the silly question.........please cooperate me .
My problem is that suppose I am having very big XML file with lots of child nodes inside, and from them I have to select 2 or 3 child from the list,
What would be the approach to get data in datagrid.
Suppose I am having XML document is like:- in which I have to show only 3 child nodes like BoxName , BoxDesc, Location and Status only then how can we Show these in datagrid.
Please Help me ...........

Nilanka DharmadasaRank #1,875 · 794 reputationPosted Dec 23, 2009, 1:22 AM EST
You are back.
Find my answer for your solution.
I have hardcoded the columns you need. If you want to change them you can do that by simply change that.
If you find this answer useful, please do not forget to tick 'Do you like this answer' checkbox.
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Dec 23, 2009, 1:32 AM EST
did a small change in the code. Get this.
Ankit Rathore64 reputationPosted Dec 23, 2009, 1:37 AM EST
Please just gone through my new XML,
and the code u sent me is not like that which I am looking for ........
Suppose if I have add 100 columns then what happen I am not going to write IF condition for each column.
By this the performance of the program is also reduce.
Please give the another solution.......
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Dec 23, 2009, 2:04 AM EST
Ankit Rathore64 reputationPosted Dec 23, 2009, 2:11 AM EST
Actually What kind of approach I am looking for...
just gone through that sample example .........
actually I am not able to understand it properly
Here they are fetching the "productCode" from "inventory.xml" file........
XmlNodeList elements = inventory.SelectNodes("//inventory/items/item");
foreach (XmlElement element in elements) {
string productCode = element.GetAttribute("productCode");
int quantitySold = Int32.Parse(element.GetAttribute("quantity"));
string xPathExpression = "//items/item[@productCode='" + productCode + "']";
XmlElement inventoryItem = (XmlElement)inventory.SelectSingleNode(xPathExpression);
*/
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Dec 23, 2009, 2:18 AM EST
But you want to do it without hard coding anything. This code doesnt suit your need.
Please understand your requirement and tel it to me. Otherwise both of us will waste our time.
Ankit Rathore64 reputationPosted Dec 23, 2009, 2:28 AM EST
Have u seen my XML file .........
I have to print from this XMLfile ("BoxName, BoxDesc, Location, StorageDate, StorageUntil, Status")
ok u Got it ......
Please see my XML file at once it is totally different from earlier one which I posted two days before .
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Dec 23, 2009, 2:55 AM EST