Example #1
0
    protected void Page_init(object sender, EventArgs e)
    {
        //On first page load, load the "bands"
        if (ViewState["reviewers"] == null)
        {

            XMLReaderWriter reader = new XMLReaderWriter("C:\\Users\\NikLubz\\SkyDrive\\Documents\\Third Year\\Web Technologies\\Assignment 5\\data.xml");
            reader.readXml();
            reviewers = reader.getReviewers();
            ViewState.Add("bands", reviewers);
        }
        else
        {
            reviewers = (Reviewer[])ViewState["bands"];
        }

        if (!IsPostBack)
        {
            //Create the Data for the gridviews
            var list = reviewers.Select(r => new
            {
                name = r.getName(),
                id = r.getId(),
                company = r.getCompany()
            }).ToList();

            //Bind the data
            reviewerGrid.DataSource = list;
            reviewerGrid.DataBind();
        }
    }
Example #2
0
 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(bands, reader.getReviewers());
 }
Example #3
0
    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();
            }
        }
    }