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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Jun 21, 2010, 3:53 PM
evgenyPosted Jun 21, 2010, 9:23 AM
prasanta pradhanPosted Jun 21, 2010, 9:03 AM
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