protected void LinkButtonSaveEdit_Click(object sender, EventArgs e) { int parentID = TreeViewCategories1.SelectedNodeID; CategoriesActions categoriesActions = new CategoriesActions(); categoriesActions.UpdateCategory(parentID, TextBoxEdit.Text); TreeViewCategories1.SelectedNodeText = TextBoxEdit.Text; PanelEditCategory.Visible = false; }
protected void LinkButtonRemove_Click(object sender, EventArgs e) { int id = TreeViewCategories1.SelectedNodeID; string text = TreeViewCategories1.SelectedNodeText; CategoriesActions categoriesActions = new CategoriesActions(); categoriesActions.DeleteCategory(id); TreeNode treeNode = new TreeNode(text, id.ToString()); TreeViewCategories1.SelectedNodeCollection.Clear(); TreeViewCategories1.SelectedNodeCollection.Remove(treeNode); }
protected void Page_Load(object sender, EventArgs e) { if (Session["SelectedCategoryID"] != null) { int.TryParse(Session["SelectedCategoryID"].ToString(), out selectedCategoryID); ListGoods1.SelectedCategoryID = selectedCategoryID; if (!Page.IsPostBack) { CategoriesActions categotiesActions = new CategoriesActions(); LabelSelectedCategory.Text = "Category selected: " + categotiesActions.FindCategoryName(selectedCategoryID); } } }
protected void LinkButtonAddCategory_Click(object sender, EventArgs e) { int parentID = TreeViewCategories1.SelectedNodeID; //if (int.TryParse(TreeViewCategories1.SelectedNodeID, out parentID)) { CategoriesActions categoriesActions = new CategoriesActions(); Categories categories = new Categories(); categories.Name = TextBoxAddCategory.Text; int createdID = categoriesActions.AddCategoty(categories, parentID); TreeNode treeNode = new TreeNode(categories.Name, createdID.ToString()); //TreeViewManage.SelectedNode.ChildNodes.Add(treeNode); TreeViewCategories1.SelectedNodeCollection.Add(treeNode); } TextBoxAddCategory.Text = ""; PanelAddCategory.Visible = false; }
protected void ButtonAdd_Click(object sender, EventArgs e) { RelationsCategoriesGoodsActions R_C_G_Actions = new RelationsCategoriesGoodsActions(); int SelectedCategoryID = TreeViewControl1.SelectedNodeID; LabelAddSuccess.Text = R_C_G_Actions.AddCategoriesToGoods(SelectedCategoryID, SelectedGoodsID); if (ViewState["categoriesGoodsList"] != null) { categoriesGoodsList = (List<Categories>)ViewState["categoriesGoodsList"]; CategoriesActions categoriesActions = new CategoriesActions(); categoriesGoodsList.Add(categoriesActions.FindCategory(SelectedCategoryID)); RepeaterGoodsCategories.DataSource = categoriesGoodsList; ViewState["categoriesGoodsList"] = categoriesGoodsList; } else { categoriesGoodsList = R_C_G_Actions.GetCategoriesForGoods(SelectedGoodsID); RepeaterGoodsCategories.DataSource = categoriesGoodsList; ViewState["categoriesGoodsList"] = categoriesGoodsList; } RepeaterGoodsCategories.DataBind(); PanelAddCategory.Enabled = false; }
public void TreeViewManage_SelectedNodeChanged(object sender, EventArgs e) { _isSelectedCategory = true; _parrentName = TreeViewManage.SelectedNode.Text; int.TryParse(TreeViewManage.SelectedNode.Value, out _parentId); //ViewState.Add("ParentID", ParentID); if (ParentID > 0 && TreeViewManage.SelectedNode.ChildNodes.Count == 0) { var categoriesActions = new CategoriesActions(); var listCategories = categoriesActions.GetCategories(_parentId); foreach (var item in listCategories) { var treeNode = new TreeNode(item.Name, item.ID.ToString()); TreeViewManage.SelectedNode.ChildNodes.Add(treeNode); } } TreeViewManage.SelectedNode.Expand(); var args = new TreeViewManageEventArgs(TreeViewManage.SelectedNode); OnSelectedNodeChanged(args); }