Hi
Please try like below:
public ActionResult Index()
{
slider slider = new slider();
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("D:/Data/Projects/AML/AML/AML/imagePath.xml");
int nodecount = xmldoc.SelectNodes("/images/imagepath").Count;
string[] imagepaths= new string[nodecount];
string[] imageText = new string[nodecount];
List<slider> imageList = new List<slider>();
for(int i=0;i<nodecount;i++)>
{
imageList.Add(new slider
{
imagepaths=Convert.ToString(xmldoc.GetElementsByTagName("path")[i].InnerText),
imageText=Convert.ToString(xmldoc.GetElementsByTagName("text")[i].InnerText)
});
}
return View();
}
View
@model IEnumerable<slider>
<div>
@{
foreach (var a in @Model)
{
<table>
<tr>
<td>@a.imageList</td>
</tr>
<tr><td>@a.imageText</td></tr>
</table>
}
}
</div>
</mvcapptest.controllers.homecontroller.slider>
Regards
Dominic