protected void uiButtonCancel_Click(object sender, EventArgs e) { Clearfields(); CurrentVedio = null; uiPanelEdit.Visible = false; uiPanelViewSubCategories.Visible = true; }
protected void uiButtonUpdate_Click(object sender, EventArgs e) { if (CurrentVedio != null) { UpdateRecord(); } else { AddNewRecord(); } uiPanelEdit.Visible = false; uiPanelViewSubCategories.Visible = true; BindData(); Clearfields(); CurrentVedio = null; }
private void BindData() { if (Request.QueryString["catid"] != null && !string.IsNullOrEmpty(Request.QueryString["catid"])) { SubCategories scat = new SubCategories(); scat.GetSubCatsByCategoryID(Convert.ToInt32(Request.QueryString["catid"].ToString())); PagedDataSource pds = new PagedDataSource(); pds.DataSource = scat.DefaultView; pds.AllowPaging = true; pds.PageSize = 6; pds.CurrentPageIndex = currentPageSub; uiDataListSub.DataSource = pds; uiDataListSub.DataBind(); uiLinkButtonSubPrev.Enabled = true; uiLinkButtonSubNext.Enabled = true; if (currentPageSub == 0) { uiLinkButtonSubPrev.Enabled = false; } if (currentPageSub == (pds.PageCount - 1)) { uiLinkButtonSubNext.Enabled = false; } uiPanelSubCats.Visible = true; uiPanelCats.Visible = false; uiPanelVideos.Visible = false; } else if (Request.QueryString["scatid"] != null && !string.IsNullOrEmpty(Request.QueryString["scatid"])) { GeneralVideos objData = new GeneralVideos(); objData.GetGeneralVideosBySubCategoryID(Convert.ToInt32(Request.QueryString["scatid"].ToString())); PagedDataSource pds = new PagedDataSource(); pds.DataSource = objData.DefaultView; pds.AllowPaging = true; pds.PageSize = 6; pds.CurrentPageIndex = currentPage; uiDataListVideos.DataSource = pds; uiDataListVideos.DataBind(); uiLinkButtonPrev.Enabled = true; uiLinkButtonNext.Enabled = true; if (currentPage == 0) { uiLinkButtonPrev.Enabled = false; } if (currentPage == (pds.PageCount - 1)) { uiLinkButtonNext.Enabled = false; } uiPanelSubCats.Visible = false; uiPanelCats.Visible = false; uiPanelVideos.Visible = true; } else { Categories scat = new Categories(); scat.GetCategoriesByTypeID(1); PagedDataSource pds = new PagedDataSource(); pds.DataSource = scat.DefaultView; pds.AllowPaging = true; pds.PageSize = 6; pds.CurrentPageIndex = currentPageCat; uiDataListCats.DataSource = pds; uiDataListCats.DataBind(); uiLinkButtonCatPrev.Enabled = true; uiLinkButtonCatNext.Enabled = true; if (currentPageCat == 0) { uiLinkButtonCatPrev.Enabled = false; } if (currentPageCat == (pds.PageCount - 1)) { uiLinkButtonCatNext.Enabled = false; } uiPanelSubCats.Visible = false; uiPanelCats.Visible = true; uiPanelVideos.Visible = false; } }
protected void uiGridViewSubCategories_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditVideo") { GeneralVideos objData = new GeneralVideos(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxArName.Text = objData.ArTitle; uiTextBoxURL.Text = objData.URL; uiTextBoxArDesc.Text = objData.Description; uiDropDownListSubCats.SelectedValue = objData.SubCategoryID.ToString(); uiPanelViewSubCategories.Visible = false; uiPanelEdit.Visible = true; CurrentVedio = objData; uiPanelEdit.Visible = true; } else if (e.CommandName == "DeleteVideo") { GeneralVideos objData = new GeneralVideos(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentVedio = null; BindData(); } }
private void BindData() { GeneralVideos objData = new GeneralVideos(); if (uiDropDownListSubCats.SelectedIndex > -1) objData.GetGeneralVideosBySubCategoryID(Convert.ToInt32(uiDropDownListSubCats.SelectedValue)); uiGridViewSubCategories.DataSource = objData.DefaultView; uiGridViewSubCategories.DataBind(); }
private void AddNewRecord() { GeneralVideos objData = new GeneralVideos(); objData.AddNew(); objData.ArTitle = uiTextBoxArName.Text; objData.Description = uiTextBoxArDesc.Text; objData.URL = uiTextBoxURL.Text; objData.SubCategoryID = Convert.ToInt32(uiDropDownListSubCats.SelectedValue); objData.Save(); }