Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<profile type="ptPerson">
  <people>
    <person>
      <domain>http://www.peoplefinders.com</domain>
      <id>5397080</id>
      <name>
        <title></title>
        <firstName>ABRAHAM</firstName>
        <middleName></middleName>
        <lastName>CHARLOTTEAA</lastName>
        <fullName>ABRAHAM CHARLOTTEAA</fullName>
      </name>
      <age>95</age>
      <dob>AV</dob>
      <address>AV</address>
      <phone>855-241-0552</phone>
      <business></business>
      <link>order.asp?1=ABRAHAM;;;;CHARLOTTEAA;;;;;;;;;;;;;;;;;;5397080&amp;2=name&amp;3=people&amp;4=14&amp;5=Abraham;;;;Aaron;;;;;;;;;;;;&amp;from=dcwTest</link>
      <email></email>
      <akas>
        <name>
          <title></title>
          <firstName>ABRAHAM</firstName>
          <middleName></middleName>
          <lastName>AARON</lastName>
          <fullName>ABRAHAM AARON</fullName>
        </name>
      </akas>
      <cities>
        <locale>
          <city>Pompano Beach</city>
          <state>FL</state>
        </locale>
      </cities>
      <relatives>
        <relative>
          <name>
            <title></title>
            <firstName>CHARLOTTE</firstName>
            <middleName>W</middleName>
            <lastName>AARON</lastName>
            <fullName>CHARLOTTE W AARON</fullName>
          </name>
          <id>5397088</id>
          <link>order.asp?1=CHARLOTTE;;W;;AARON;;;;;;;;;;;;;;;;;;5397088&amp;2=name&amp;3=people&amp;4=1&amp;5=Abraham;;;;Aaron;;;;;;;;;;;;&amp;from=dcwTest</link>
        </relative>
      </relatives>
      <key>ABRAHAM CHARLOTTEAA</key>
      <source>dsPeopleFinders</source>
      <itemType>itPerson</itemType>
    </person>
</people>


I want to search for full details of specific persons in this xml file whose first name and last name are passed from textboxes on the webform.
i.e on Form1--> textbox1--> firstname
textbox2 -- > lastname
textbox3--> city
now on the result page...i get these values as querystring.... and based on these values i have to search values from the xml file and display them in the gridview.
pls guide...
Thanks....
vikas
Posted
Updated 28-Mar-11 18:29pm
v2

1 solution

MSIL
public void fillfromXML(string Code)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(Server.MapPath(@"XMLFile1.xml"));
            XmlNodeList addlst = doc.SelectNodes("people/person/name/firstName");
            foreach (XmlNode Empcode in addlst)
            {
                //pass textbox value for Code
                if (Empcode.InnerText == Code)
                {
                    //code to get the values and display in gridview.
                }
            }
        }
 
Share this answer
 
Comments
Vikas1546 29-Mar-11 1:03am    
@mkgoud
...Thanks buddy for ur timely help... but can u pls eloborate...
... can u pls give more code snippets for doing this..
..Thanks..
Vikas1546 29-Mar-11 1:06am    
i.e how to fill a datatable or dataset using this..to bind with the gridview
m@dhu 29-Mar-11 1:09am    
Check the link
http://www.developer.com/net/asp/article.php/3553881/Binding-to-XML-Data-in-ASPNET-20.htm
Veeraiahkatteboina 1-Feb-13 1:56am    
hai

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900