protected void Page_Load(object sender, EventArgs e) { if ((null != Session["BookList"]) && (null != Request.QueryString["isbn"])) { book = bookController.RetrieveBookDetails(Request.QueryString["isbn"], Session["BookList"] as List <Book>); if (!IsPostBack) { FillBookDetails(); } } else { Response.Redirect("~/"); } }
/// <summary> /// Loads the page and populates all the fields. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if ((null != Session["BookList"]) && (null != Request.QueryString["isbn"])) { Book book = bookController.RetrieveBookDetails(Request.QueryString["isbn"], Session["BookList"] as List <Book>); BookIsbnTextBox.Text = book.PrimaryKey.Key.ToString(); BookTitleTextBox.Text = book.Title; BookDescriptionTextBox.Text = book.Description; BookPublicatinDateTextBox.Text = book.PublicationDate.Value.ToString(@"yyyy-MM-dd"); BookQuantityAvailableTextBox.Text = book.QuantityAvailable.ToString(); BookEditionTextBox.Text = book.Edition.ToString(); BookAvailableDropDownList.SelectedValue = book.IsAvailable ? "1" : "0"; BookPagesTextBox.Text = book.Pages.ToString(); BookImageUrl01.Text = book.ImageUrl01; if (!string.IsNullOrEmpty(book.ImageUrl02)) { BookImageUrl02.Text = book.ImageUrl02; } if (!string.IsNullOrEmpty(book.ImageUrl03)) { BookImageUrl03.Text = book.ImageUrl03; } if (!string.IsNullOrEmpty(book.ImageUrl04)) { BookImageUrl04.Text = book.ImageUrl04; } if (!string.IsNullOrEmpty(book.ImageUrl05)) { BookImageUrl05.Text = book.ImageUrl05; } } else { Response.Redirect("~/"); } } }