protected void choosearticleclick(object sender, EventArgs e) { // the command name is the id of the layout to choose. // command argument is the filename of layout to use sessionarticles sa; sa = (sessionarticles)Session["sessionarticles"]; if (sa == null) { sa = new sessionarticles(); } sa.addsessionarticle(articlename, (sender as LinkButton).CommandName); sa.setcookie(Response); Session["sessionarticles"] = sa; // if we are coming from the review page then jump straight to the customise page and ask it to jump straight back to the review afterwards if (Request.QueryString["return"] == "true") { Response.Redirect("~/customise_articles.aspx?article=" + articleindex.ToString() + "?return=true"); } // otherwise if we have finished choosing articles go on to customise them else if (articleindex >= pl.articles.Count - 1) { Response.Redirect("~/customise_articles.aspx"); } // otherwise choose the next article else { Response.Redirect("~/choose_articles.aspx?article=" + (articleindex + 1).ToString()); } }
protected void Page_Load(object sender, EventArgs e) { // get the article index to choose from the query string try { farticleindex = Convert.ToInt16(Request.QueryString["article"]); } catch { farticleindex = 0; } // get the page layout spl = (sessionpagelayout)Session["sessionpagelayout"]; if (spl == null) { Response.Redirect("~/default.aspx", true); } pl = ceddio.loadpagelayout(spl.pagelayoutfilename); // if there is no layout specified the redirect back to the home page if (pl == null) { Response.Redirect("~/default.aspx", true); } // get the customisation scs = (sessioncustomisations)Session["sessioncustomisation"]; if (scs == null) { scs = new sessioncustomisations(); } // get all the articles and add all customisable items sas = (sessionarticles)Session["sessionarticles"]; if (sas == null) { Response.Redirect("~/default.aspx", true); } sa = sas.getarticle(pl.articles[articleindex].name); if (sa == null) { Response.Redirect("~/default.aspx", true); } if (Page.IsPostBack == false) { setuppage(); } else { savecustomisations(); } }