internal void save() { //Save the xml. XMLReaderWriter reader = new XMLReaderWriter("C:\\Users\\NikLubz\\SkyDrive\\Documents\\Third Year\\Web Technologies\\Assignment 5\\data.xml"); reader.readXml(); reader.writeXML(reader.getBands(), reviewers); }
protected void Page_init(object sender, EventArgs e) { //On first page load, load the "bands" if (ViewState["bands"] == null) { XMLReaderWriter reader = new XMLReaderWriter("C:\\Users\\NikLubz\\SkyDrive\\Documents\\Third Year\\Web Technologies\\Assignment 5\\data.xml"); reader.readXml(); bands = reader.getBands(); ViewState.Add("bands", bands); } else { bands = (Band[])ViewState["bands"]; } if (!IsPostBack) { //Create the Data for the gridviews var list = bands.Select(b => new { name = b.getName() }).ToList(); //Bind the data bandsTable.DataSource = list; bandsTable.DataBind(); } }
protected void Page_init(object sender, EventArgs e) { //On first page load, load the "bands" if (ViewState["bands"] == null) { XMLReaderWriter reader = new XMLReaderWriter("C:\\Users\\NikLubz\\SkyDrive\\Documents\\Third Year\\Web Technologies\\Assignment 5\\data.xml"); reader.readXml(); //Get All bands bands = reader.getBands(); //Get all albums List<Album> tempAlbum = new List<Album>(); foreach (Band b in bands) tempAlbum.AddRange(b.getAlbums()); albums = tempAlbum.ToArray(); //Get All Members List<Member> tempMember = new List<Member>(); foreach (Band b in bands) tempMember.AddRange(b.getMembers()); members = tempMember.ToArray(); //Save to viewstate ViewState.Add("bands", bands); ViewState.Add("albums", albums); ViewState.Add("members", members); } else { bands = (Band[])ViewState["bands"]; albums = (Album[])ViewState["albums"]; members = (Member[])ViewState["members"]; } if (!IsPostBack) { //bands var list = bands.Select(b => new { name = b.getName() }).ToList(); bandDropDown.DataSource = list; bandDropDown.DataValueField = "name"; bandDropDown.DataBind(); //albums list = albums.Select(a => new { name = a.getName() }).ToList(); albumDropDown.DataSource = list; albumDropDown.DataValueField = "name"; albumDropDown.DataBind(); //members list = members.Select(m => new { name = m.getName() }).ToList(); memberDropDown.DataSource = list; memberDropDown.DataValueField = "name"; memberDropDown.DataBind(); } }
protected void Page_init(object sender, EventArgs e) { //On first page load, load the "bands" if (ViewState["bands"] == null) { XMLReaderWriter reader = new XMLReaderWriter("C:\\Users\\NikLubz\\SkyDrive\\Documents\\Third Year\\Web Technologies\\Assignment 5\\data.xml"); reader.readXml(); bands = reader.getBands(); reviewers = reader.getReviewers(); ViewState.Add("bands", bands); ViewState.Add("reviewers", reviewers); } else { bands = (Band[])ViewState["bands"]; reviewers = (Reviewer[])ViewState["reviewers"]; } if (!IsPostBack) { //Create the Data for the gridviews var list = bands.Select(b => new { name = b.getName() }).ToList(); //Bind the data bandDropDown.DataSource = list; bandDropDown.DataValueField = "name"; bandDropDown.DataBind(); selectedBand = bands.Where(b => b.getName() == bandDropDown.SelectedItem.Text).ToList().First(); if(selectedBand != null) { list = selectedBand.getAlbums().Select(a => new { name = a.getName() }).ToList(); list.Add(new { name = "Create new Album" }); albumDropDown.DataSource = list; albumDropDown.DataValueField = "name"; albumDropDown.DataBind(); } } }