protected void BtnSaveSlider_Click(object sender, EventArgs e) { Slider UpdateSlider = new Slider(); if (getQueryString>0) { UpdateSlider.LoadByPrimaryKey(getQueryString); } else { UpdateSlider.AddNew(); } UpdateSlider.TitleEn = Server.HtmlEncode(uiFCKeditorTitle.Value); UpdateSlider.SliderDescriptionEn = Server.HtmlEncode(uiFCKeditorDesc.Value); if (UploadImgSlider.HasFile) { string path = "/admin/UploadedFiles/sliderimg/" + DateTime.Now.ToString("ddmmyyyyhhmmss") + UploadImgSlider.FileName; //Bitmap upimg = (Bitmap)Bitmap.FromStream(UploadImgSlider.PostedFile.InputStream); //upimg.Save(MapPath(path), System.Drawing.Imaging.ImageFormat.Png); UploadImgSlider.SaveAs(Server.MapPath("~" + path)); UpdateSlider.ImagePath = path; } UpdateSlider.IsActive = chkboxActive.Checked; UpdateSlider.Save(); Response.Redirect("SliderPage.aspx"); GrdBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.Page page = new BLL.Page(); page.LoadByPrimaryKey(7); uiLiteralContent.Text = Server.HtmlDecode(page.ContentAr); BLL.Slider slides = new Slider(); slides.GetActiveSlides(); uiRepeaterSlider.DataSource = slides.DefaultView; uiRepeaterSlider.DataBind(); } }
protected void GrdSlider_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName=="EditSlider") { Response.Redirect("SliderPage.aspx?PID=" + e.CommandArgument.ToString()); } else if (e.CommandName=="DeleteSlider") { Slider DeleteSlider = new Slider(); DeleteSlider.LoadByPrimaryKey(int.Parse(e.CommandArgument.ToString())); DeleteSlider.MarkAsDeleted(); DeleteSlider.Save(); GrdBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (getQueryString>0) { if (!Page.IsPostBack) { SliderTable.Visible = true; GrdSlider.Visible = false; BtnNewSlider.Visible = false; Slider EditSlider = new Slider(); EditSlider.LoadByPrimaryKey(getQueryString); uiFCKeditorTitle.Value = Server.HtmlDecode(EditSlider.TitleEn); uiFCKeditorDesc.Value = Server.HtmlDecode(EditSlider.SliderDescriptionEn); chkboxActive.Checked = EditSlider.IsActive; SliderBannerImg.Src = EditSlider.ImagePath; SliderBannerImg.Visible = true; //txtSliderLink.Text = EditSlider.SliderLink; BtnSaveSlider.Text = "Update Slider"; } } else if (!string.IsNullOrEmpty(Request.QueryString["NewSlider"])) { if (!Page.IsPostBack) { SliderTable.Visible = true; GrdSlider.Visible = false; BtnNewSlider.Visible = false; } } else { if (!Page.IsPostBack) { SliderTable.Visible = false; GrdSlider.Visible = true; BtnNewSlider.Visible = true; } } if (!Page.IsPostBack) { GrdBind(); } }
private void GrdBind() { Slider AllSliders = new Slider(); AllSliders.LoadAll(); GrdSlider.DataSource = AllSliders.DefaultView; GrdSlider.DataBind(); }