Issues displaying XML in MVC with jquery

I can't get this to display the XML file. I can provide any additional code as needed. It displays the table but not the data within the table.

DataRepository.cs

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Xml.Linq; using MvcApp.Models;

namespace MvcApp.Repository { public class DataRepository: IDataRepository { public List<StateModel> AllStateModels { get; set; } public XDocument XMLData { get; set; }

 public DataRepository() { AllStateModels = new List<StateModel>(); XMLData = XDocument.Load(HttpContext.Current.Server.MapPath("~/App_Data/USStates.xml")); var states = from state in XMLData.Descendants("state") select new StateModel() { Name = state.Element("Name").Value, Abbreviation = state.Element("Abbreviation").Value }; AllStateModels.AddRange(states.ToList<StateModel>()); } public IEnumerable<StateModel> GetStateModels() { return AllStateModels; } } 

}

by CaitlinS9 via /r/csharp

Leave a Reply