protected void btnUpload_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { if (Membership.GetUser() != null) { try { AssignmentModelClass a = new AssignmentModelClass(); a.AddNewMediaFile(tbTItle.Text, tbDescription.Text, ref FileUpload1); lblResult.ForeColor = System.Drawing.Color.Green; lblResult.Text = "The file has been added to the object store"; tbDescription.Text = ""; tbTItle.Text = ""; //Response.Redirect("http://warp.senecac.on.ca/bti420_121a29/Media/Default.aspx"); } catch (Exception ex) { lblResult.ForeColor = System.Drawing.Color.Red; lblResult.Text = "Error! " + ex.Message; } } } else { lblResult.Text = "Error! Please Uplaod a file"; lblResult.ForeColor = System.Drawing.Color.Red; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AssignmentModelClass a = new AssignmentModelClass(); System.Web.HttpApplication _context; _context = System.Web.HttpContext.Current.ApplicationInstance; string _root = ""; _root = _context.Server.MapPath("~/"); DropDownList1.DataSource = a.getfolders(_root); DropDownList1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { // First load tasks if (!IsPostBack) { // Initialize the manager object manager = new AssignmentModelClass(); // Fetch the page ictPage page = manager.GetPageByID(pageID); // Configure the page content editor and the user interface if (page != null) { litContent.Text = page.Content; editor.Text = litContent.Text; tbTitle.Text = page.Title; ViewState["PageTitle"] = page.Title; } else { litContent.Text = ""; editor.Text = litContent.Text; tbTitle.Text = ""; ViewState["PageTitle"] = ""; } } Page.Title = ViewState["PageTitle"] as string; // Author tasks if (Page.User.IsInRole("Author")) { // Show the editing control strip pnlControl.Visible = true; // Configure the visibility of the buttons to match the view/edit mode btnEdit.Visible = !pnlEdit.Visible; btnView.Visible = btnPageContent.Visible = btnMediaList.Visible = btnMediaUpload.Visible = pnlEdit.Visible; // Update the user interface lblStatus.Text = ""; // The following block will capture the intent of the editor's "save" icon // Clicking the icon in the CKEditor causes a postback // Therefore, we will check here to see if the content and title have changed // If yes, we will save the changes, and update the user interface string editorText = editor.Text; string literalText = litContent.Text; string textboxTitle = tbTitle.Text.Trim(); string viewstateTitle = ViewState["PageTitle"] as string; if ((editorText != literalText) | (textboxTitle != viewstateTitle)) { // Save the changes manager = new AssignmentModelClass(); manager.UpdatePageContentByID(pageID, textboxTitle, editorText); // Update the user interface Page.Title = textboxTitle; ViewState["PageTitle"] = textboxTitle; litContent.Text = editorText; lblStatus.Text = "Changes have been saved"; } } // Author tasks }
protected void Button1_Click(object sender, EventArgs e) { AssignmentModelClass b = new AssignmentModelClass(); b.CreateNewEditablePage(TextBox1.Text, DropDownList1.SelectedItem.Text); Response.Redirect("~/"+ DropDownList1.SelectedItem.Text +"/"+ TextBox1.Text + ".aspx"); }