I have created an xml and have been able to call them nicely an populated them in imageButton and Labels using c#. i want to give the imageButton a PostBackUrl so that when you click on one of the imageButton, you will be redirect to another page with the information of that chosen item(ID). This is the class i used to call all the elements:
public class XMLHelper
{
public List<CarClass> GetList()
{
XmlDocument xdoc = new XmlDocument();
xdoc.Load(HttpContext.Current.Server.MapPath("~/advertenties.xml"));
XmlNodeList AdvCars = xdoc.SelectNodes("/root/advertentie");
var listOfAdStarCar = new List<CarClass>();
if (AdvCars != null)
{
foreach (XmlNode AdvCar in AdvCars)
{
var newAdStarCar = new CarClass();
//UnqNr
var unqNum = AdvCar.SelectSingleNode("unieknummer");
if (unqNum != null)
{
newAdStarCar.unqNr = Convert.ToInt32(unqNum.InnerText);
}
//lastMute
var lastMute = AdvCar.SelectSingleNode("laatstemutatie");
if (lastMute != null)
{
newAdStarCar.lastM = Convert.ToDateTime(lastMute.InnerText);
}
//name
var Dealername = AdvCar.SelectSingleNode("dealer/naam");
if (Dealername != null)
{
newAdStarCar.name = Dealername.InnerText;
}
//email
var E_mail = AdvCar.SelectSingleNode("dealer/email");
if (E_mail != null)
{
newAdStarCar.email = E_mail.InnerText;
}
//carNumber
var CarNummer = AdvCar.SelectSingleNode("auto/kenteken");
if (CarNummer != null)
{
newAdStarCar.CarNr = CarNummer.InnerText;
}
//company
var CarCompany = AdvCar.SelectSingleNode("auto/merk");
if (CarCompany != null)
{
newAdStarCar.CarCompany = CarCompany.InnerText;
}
//CarModel
var CarModel = AdvCar.SelectSingleNode("auto/model");
if (CarModel != null)
{
newAdStarCar.CarModel = CarModel.InnerText;
}
//BigImg
var FirstBigImage = AdvCar.SelectSingleNode("afbeeldingen/fotoGroot");
if (FirstBigImage != null)
{
newAdStarCar.BigImg = FirstBigImage.InnerText;
}
listOfAdStarCar.Add(newAdStarCar);
}
}
return listOfAdStarCar;
}
I've done this a couple of time with database, entity framework and there i did something like public class GetCar(int CarId){and here i will give somthing Find(CarId)} but I'm kind a stuck with XML
I'm looking forward to your replies
Thanks in advance