protected void Page_Load(object sender, EventArgs e) { int NodeType, TreeType; Notes = new NoteTree( gvSummarize, lblPercentReduction, lblNoteTools, lblInfoTools, lbxNodes, lbxInfo, lbxKeys, drpKeys, drpFilterOn, drpSearchOn, drpTxtOpr, drpInfoTypes, drpSummaries, drpPictureType, btnUp, btnDown, btnSummary, btnRefresh, btnRefreshInfo, btnEdit, btnEditInfo, btnNew, btnNewInfo, btnNewChild, btnInfoNode, btnRestoreInfo, btnSave, btnSaveInfo, btnAddKeyWord, btnNewSummary, btnSaveSummary, btnPrevPicture, btnNextPicture, btnSavePicture, btnGo, btnBackOut, btnSearch, btnSrchBack, rdoNotes, rdoInfo, rdoSmallSumm, rdoLargeSumm, rdoLargestSumm, filUpload, Picture, txtFilterText, txtSearchFilter, txtKeyWord, txtHeading, txtNodeText, txtPictureTitle, txtSummText, txtTxtSpecs); if (!Page.IsPostBack) { // Initialize all settings NodeType = 5; TreeType = 2; Notes.InitialSettings(TreeType, NodeType); using (HowToDBEntities db = new HowToDBEntities()) { var nodes = from n in db.Nodes where n.TreeID == 2 && n.TreeLevel == 1 orderby n.Heading select new { n.Heading, n.NodeID }; if (nodes.Count() > 0) { lbxNodes.DataSource = nodes.ToList(); lbxNodes.DataBind(); } var infos = from i in db.Infoes where i.TreeID == 2 select i; if (infos.Count() > 0) { lbxInfo.DataSource = infos.ToList(); lbxInfo.DataBind(); } var keys = (from n in db.Keys where n.TreeID == 2 orderby n.KeyText select new { n.KeyText, }).Distinct(); if (keys.Count() > 0) { lbxKeys.DataSource = keys.ToList(); lbxKeys.DataBind(); } var infotypes = from t in db.Typs where t.Category == "Info" select t; if (infotypes.Count() > 0) { drpInfoTypes.DataSource = infotypes.ToList(); drpInfoTypes.DataBind(); } var picturetypes = from t in db.Typs where t.Category == "Pictures" select t; if (infos.Count() > 0) { drpPictureType.DataSource = picturetypes.ToList(); drpPictureType.DataBind(); } } Notes.NodeChanged(); SetViewStates("Define"); SetViewStates("All"); } else { // Copy from viewstate variables SetViewStates("PostBack"); using (HowToDBEntities db = new HowToDBEntities()) { var infotypes = from t in db.Typs where t.Category == "Info" select t; if (infotypes.Count() > 0) { drpInfoTypes.DataSource = infotypes.ToList(); drpInfoTypes.DataBind(); } var picturetypes = from t in db.Typs where t.Category == "Pictures" select t; if (picturetypes.Count() > 0) { drpPictureType.DataSource = picturetypes.ToList(); drpPictureType.DataBind(); } } } }
protected void lbxNodes_SelectedIndexChanged(object sender, EventArgs e) { Notes.NodeChanged(); Notes.Item = 0; Notes.Operation = "Browse"; SetViewStates("NodeChanged"); }