here is the whole code so far,
XPathDocument document = new XPathDocument(path);
navigator = document.CreateNavigator();
navigator.MoveToRoot();
navigator.MoveToChild("Contacts", String.Empty);
navigator.MoveToFirstChild();
DisplayData();
Session["navigator"] = navigator;
}
else
{
navigator = (XPathNavigator)Session["navigator"];
}
}
private void DisplayData()
{
lableID.Text = navigator.GetAttribute("ID", String.Empty);
navigator.MoveToFirstChild();
lableCategory.Text = navigator.Value;
navigator.MoveToNext();
navigator.MoveToFirstChild();
lableFirstName.Text = navigator.Value;
navigator.MoveToNext();
lableLastName.Text = navigator.Value;
navigator.MoveToParent();
navigator.MoveToNext();
navigator.MoveToFirstChild();
lableStreet.Text = navigator.Value;
navigator.MoveToNext();
lableCity.Text = navigator.Value;
navigator.MoveToNext();
lableState.Text = navigator.Value;
navigator.MoveToNext();
lableZip.Text = navigator.Value;
navigator.MoveToParent();
navigator.MoveToNext();
lablePhone.Text = navigator.Value;
navigator.MoveToParent();
}
protected void btnNext_Click(object sender, EventArgs e)
{
if (navigator.MoveToNext())
{
DisplayData();
btnPrevious.Enabled = true;
}
else
{
btnNext.Enabled = false;
}
}
protected void btnPrevious_Click(object sender, EventArgs e)
{
if (navigator.MoveToPrevious())
{
DisplayData();
btnNext.Enabled = true;
}
else
{
btnPrevious.Enabled = false;
}
}
protected void btnFirstContact_Click(object sender, EventArgs e)
{
}
}
}