protected void uiDropDownListPages_SelectedIndexChanged(object sender, EventArgs e) { Categories cats = new Categories(); cats.GetCategoriesByTypeIDAndPageID(4, Convert.ToInt32(uiDropDownListPages.SelectedValue)); uiDropDownListAllCategories.DataSource = cats.DefaultView; uiDropDownListAllCategories.DataTextField = "Title"; uiDropDownListAllCategories.DataValueField = "CategoryID"; uiDropDownListAllCategories.DataBind(); if (cats.RowCount > 0) uiDropDownListAllCategories.SelectedIndex = 0; }
protected void uiButtonUpdate_Click(object sender, EventArgs e) { if (CurrentCategory != null) { UpdateRecord(); } else { AddNewRecord(); } uiPanelEdit.Visible = false; uiPanelViewCategories.Visible = true; BindData(); Clearfields(); CurrentCategory = null; }
protected void uiGridViewCategories_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditCategory") { Categories objData = new Categories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxArName.Text = objData.Title; uiPanelViewCategories.Visible = false; uiPanelEdit.Visible = true; CurrentCategory = objData; } else if (e.CommandName == "DeleteCategory") { Categories objData = new Categories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentCategory = null; BindData(); } }
private void BindData() { Categories objData = new Categories(); objData.GetCategoriesByTypeID(2); uiGridViewCategories.DataSource = objData.DefaultView; uiGridViewCategories.DataBind(); }
private void AddNewRecord() { Categories objData = new Categories(); objData.AddNew(); objData.Title = uiTextBoxArName.Text; if (uiFileUploadPicturePath.HasFile) { uiFileUploadPicturePath.SaveAs(Server.MapPath("~/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName)); objData.IconPath = "/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName; } objData.TypeID = 2; objData.Save(); }
private void LoadDDls() { Categories cats = new Categories(); cats.GetCategoriesByTypeID(1); uiDropDownListAllCategories.DataSource = cats.DefaultView; uiDropDownListAllCategories.DataTextField = "Title"; uiDropDownListAllCategories.DataValueField = "CategoryID"; uiDropDownListAllCategories.DataBind(); uiDropDownListAllCategories.SelectedIndex = 0; }
private void LoadFilesCats() { Categories cats = new Categories(); cats.GetCategoriesByTypeIDAndPageID(3, CurrentPage.PageID); uiDropDownListAllCategories.DataSource = cats.DefaultView; uiDropDownListAllCategories.DataTextField = "Title"; uiDropDownListAllCategories.DataValueField = "CategoryID"; uiDropDownListAllCategories.DataBind(); if (cats.RowCount > 0) uiDropDownListAllCategories.SelectedIndex = 0; SubCategories Scats = new SubCategories(); if (uiDropDownListAllCategories.SelectedIndex != -1) { Scats.GetSubCatsByCategoryID(Convert.ToInt32(uiDropDownListAllCategories.SelectedValue)); } uiDropDownListsubCats.DataSource = Scats.DefaultView; uiDropDownListsubCats.DataTextField = "Title"; uiDropDownListsubCats.DataValueField = "SubCategoryID"; uiDropDownListsubCats.DataBind(); if (Scats.RowCount > 0) LoadFiles(); }
private void LoadDDLs() { Categories objData = new Categories(); objData.GetCategoriesByTypeID(1); uiDropDownListAllCategories.DataSource = objData.DefaultView; uiDropDownListAllCategories.DataTextField = "Title"; uiDropDownListAllCategories.DataValueField = "CategoryID"; uiDropDownListAllCategories.DataBind(); uiDropDownListAllCategories.SelectedIndex = 0; SubCategories obj = new SubCategories(); obj.GetSubCatsByCategoryID(Convert.ToInt32(uiDropDownListAllCategories.SelectedValue)); uiDropDownListSubCats.DataSource = obj.DefaultView; uiDropDownListSubCats.DataTextField = "Title"; uiDropDownListSubCats.DataValueField = "SubCategoryID"; uiDropDownListSubCats.DataBind(); uiDropDownListSubCats.SelectedIndex = 0; }
private void LoadDDls() { Pages pages = new Pages(); pages.LoadAll(); uiDropDownListPages.DataSource = pages.DefaultView; uiDropDownListPages.DataTextField = "ArTitle"; uiDropDownListPages.DataValueField = "PageID"; uiDropDownListPages.DataBind(); uiDropDownListPages.SelectedIndex = 0; Categories cats = new Categories(); cats.GetCategoriesByTypeIDAndPageID(4, Convert.ToInt32(uiDropDownListPages.SelectedValue)); uiDropDownListAllCategories.DataSource = cats.DefaultView; uiDropDownListAllCategories.DataTextField = "Title"; uiDropDownListAllCategories.DataValueField = "CategoryID"; uiDropDownListAllCategories.DataBind(); if (cats.RowCount > 0) uiDropDownListAllCategories.SelectedIndex = 0; }
private void BindData() { Categories objData = new Categories(); objData.GetCategoriesByTypeIDAndPageID(4, Convert.ToInt32(uiDropDownListPages.SelectedValue)); uiGridViewCategories.DataSource = objData.DefaultView; uiGridViewCategories.DataBind(); }
private void AddNewRecord() { Categories objData = new Categories(); objData.AddNew(); objData.Title = uiTextBoxArName.Text; if (uiFileUploadPicturePath.HasFile) { uiFileUploadPicturePath.SaveAs(Server.MapPath("~/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName)); objData.IconPath = "/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName; } objData.TypeID = 4; objData.PageID = Convert.ToInt32(uiDropDownListPages.SelectedValue); objData.Save(); }