Hi All!
I have xml file:
xml version="1.0" encoding="utf-8" ?>
Notes>
How can i pick records ( CDATA) only for dates <= 23/06/2010
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
prasanta pradhan48 reputationPosted Jun 21, 2010, 5:03 AM EDT
Try This Code It May Help You
protected void btnSearch_Click(object sender, EventArgs e)
{
string empid1 = txtEmpid.Text.Trim() ;
XmlDocument doc = new XmlDocument();
string xmlFile = System.Web.HttpContext.Current.Server.MapPath("~/App_Data/employee.xml");
doc.Load(xmlFile);
int empid = int.Parse(empid1);
XmlNodeList xmlnode = doc.GetElementsByTagName("employee");
for (int i = 0; i < xmlnode.Count; i++)
{
XmlAttributeCollection xmlattrc = xmlnode[i].Attributes;
if (int.Parse(xmlattrc[0].Value) > empid)
{
txtEmpid.Text = xmlattrc[0].Value;
txtFname.Text = xmlnode[i].ChildNodes[0].InnerText; //Assign First Name from XML file to txtFirstName Text Box
txtLname.Text = xmlnode[i].ChildNodes[1].InnerText; //Assign Last Name from XML file to txtLastName Text Box
txtAge.Text = xmlnode[i].ChildNodes[2].InnerText;// //Assign Age from XML file to txtAge Text Box
return;
}
else
{
//txtEmpid.Text = xmlattrc[0].Value; ;
txtFname.Text = ""; //Assign First Name from XML file to txtFirstName Text Box
txtLname.Text = ""; //Assign Last Name from XML file to txtLastName Text Box
txtAge.Text = "";// //Assign Age from XML file to txtAge Text Box
lblMsg.Text = "No record Found. !";
}
}
}
Thank's
Prasanta Kumar Pradhan
http://globaltouch.in
evgeny9 reputationPosted Jun 21, 2010, 5:23 AM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Jun 21, 2010, 11:53 AM EDT