Beispiel #1
0
        /// <summary>
        /// Raises the webpart Onload event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"></see> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            //  base.OnLoad(e);
            EnsureChildControls();
            try
            {
                pnlWellBookTreeView = new Panel();
                pnlWellBookTreeView.ID = "Panel1";
                this.Controls.Add(pnlWellBookTreeView);

                trvWellBookViewer = new RadTreeView();
                trvWellBookViewer.ID = "RadTreeView1";
                trvWellBookViewer.CheckBoxes = true;
              //  if (this.Page.Request.Params[EVENTTARGET] == null || (!this.Page.Request.Params[EVENTTARGET].ToLowerInvariant().Equals("customisechaptersinsession")))
             //       {
                    LoadRootNodes(trvWellBookViewer, TreeNodeExpandMode.ServerSideCallBack);
               // }

                    trvWellBookViewer.NodeExpand += new RadTreeViewEventHandler(treeView_NodeExpand);
                    trvWellBookViewer.NodeClick += new RadTreeViewEventHandler(treeView_NodeClick);
                    trvWellBookViewer.CheckAllNodes();
                    trvWellBookViewer.TriStateCheckBoxes = true;
                    trvWellBookViewer.CheckChildNodes = true;

                pnlWellBookTreeView.Controls.Add(trvWellBookViewer);
                this.Controls.Add(pnlWellBookTreeView);
                if (!Page.IsPostBack)
                {
                    objTreeNodeValues = new TreeNodeSelection();
                    if (trvWellBookViewer != null)
                    {
                        if (trvWellBookViewer.FindNodeByValue(HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID]) != null)
                        {
                            trvWellBookViewer.FindNodeByValue(HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID]).Selected = true;
                        }
                        if (trvWellBookViewer.SelectedNode != null && (trvWellBookViewer.SelectedNode.Level == 0 || trvWellBookViewer.SelectedNode.Level == 1))
                        {
                            Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETAB_JS_KEY, HIDETAB_JS);
                        }
                    }
                    objTreeNodeValues.IsBookSelected = true;
                    objTreeNodeValues.BookID = HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID];
                    HttpContext.Current.Session[SESSION_WEBPARTPROPERTIES] = objTreeNodeValues;
                }
                ExpandChapterNode();
                this.Page.Title = WELLBOOK_VIEWER_TITLE;
            }
            catch (WebException webEx)
            {
                CommonUtility.HandleException(strParentSiteURL, webEx);
            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(strParentSiteURL, ex);
            }
        }