当前位置: 首页>>代码示例>>C#>>正文


C# TreeNode.IsRoot方法代码示例

本文整理汇总了C#中TreeNode.IsRoot方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.IsRoot方法的具体用法?C# TreeNode.IsRoot怎么用?C# TreeNode.IsRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TreeNode的用法示例。


在下文中一共展示了TreeNode.IsRoot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnInit

    protected override void OnInit(EventArgs e)
    {
        // Culture independent data
        SplitModeAllwaysRefresh = true;

        base.OnInit(e);

        // Keep current user info
        currentUser = MembershipContext.AuthenticatedUser;

        // Keep node instance
        node = Node;

        if (node.IsRoot())
        {
            plcUILevels.Visible = false;
        }

        // Init document manager events
        DocumentManager.OnValidateData += DocumentManager_OnValidateData;
        DocumentManager.OnSaveData += DocumentManager_OnSaveData;
        DocumentManager.OnAfterAction += DocumentManager_OnAfterAction;

        EnableSplitMode = true;

        // Register the scripts
        ScriptHelper.RegisterLoader(this);
        ScriptHelper.RegisterDialogScript(this);
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:29,代码来源:Template.aspx.cs

示例2: LoadData

    /// <summary>
    /// Loads the initial data from the document
    /// </summary>
    private void LoadData()
    {
        node = Node;
        if (node == null)
        {
            return;
        }

        if (node.IsRoot())
        {
            // Hide inheritance options for root node
            pnlInherits.Visible = false;
        }
        else
        {
            inheritElem.Value = Node.NodeInheritPageLevels;

            // Try get info whether exist linked document in path
            DataSet ds = DocumentManager.Tree.SelectNodes(SiteContext.CurrentSiteName, "/%", node.DocumentCulture, false, null, "NodeLinkedNodeID IS NOT NULL AND (N'" + SqlHelper.EscapeQuotes(Node.NodeAliasPath) + "' LIKE NodeAliasPath + '%')", null, -1, false, 1, "Count(*) AS NumOfDocs");

            // If node is not link or none of parent documents is not linked document use document name path
            if (!node.IsLink && DataHelper.GetIntValue(ds.Tables[0].Rows[0], "NumOfDocs") == 0)
            {
                inheritElem.TreePath = TreePathUtils.GetParentPath("/" + Node.DocumentNamePath);
            }
            else
            {
                // Otherwise use alias path
                inheritElem.TreePath = TreePathUtils.GetParentPath("/" + Node.NodeAliasPath);
            }
        }

        if (node.NodeInheritPageTemplate)
        {
            // Document inherits template
            radInherit.Checked = true;
        }
        else
        {
            // Document has its own template
            int templateId = node.GetUsedPageTemplateId();
            radInherit.Checked = false;

            if (node.NodeTemplateForAllCultures)
            {
                radAllCultures.Checked = true;
            }
            else
            {
                radThisCulture.Checked = true;
            }

            // Set selected template ID
            SelectedTemplateID = templateId;
        }

        ReloadControls();
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:61,代码来源:Template.aspx.cs

示例3: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptHelper.RegisterEditScript(Page, false);

        // Initialize events
        ctlAsyncLog.OnFinished += ctlAsyncLog_OnFinished;
        ctlAsyncLog.OnError += ctlAsyncLog_OnError;
        ctlAsyncLog.OnCancel += ctlAsyncLog_OnCancel;

        // Get the data
        nodeId = QueryHelper.GetInteger("nodeid", 0);
        targetNodeId = QueryHelper.GetInteger("targetnodeid", 0);
        action = QueryHelper.GetString("action", "");

        if (!RequestHelper.IsCallback())
        {
            // Register the main CMS script
            ScriptHelper.RegisterCMS(Page);

            // Get the node
            node = TreeProvider.SelectSingleNode(nodeId);
            targetNode = TreeProvider.SelectSingleNode(targetNodeId, TreeProvider.ALL_CULTURES);

            // Set visibility of panels
            pnlContent.Visible = true;
            pnlLog.Visible = false;

            if ((node != null) && (targetNode != null))
            {
                string targetName = targetNode.DocumentNamePath;
                bool isRoot = targetNode.IsRoot();

                // Get the real target node
                if (!isRoot && (action.IndexOfCSafe("position", true) >= 0))
                {
                    // Get the target order and real parent ID
                    int newTargetId = targetNode.NodeParentID;
                    TreeNode realTargetNode = TreeProvider.SelectSingleNode(newTargetId);
                    if (realTargetNode != null)
                    {
                        targetName = realTargetNode.DocumentNamePath;
                    }
                }

                // Initialize resource strings, images
                btnNo.OnClientClick = "SelectNode(" + node.NodeID + "); return false;";

                lblTarget.Text = GetString("ContentOperation.TargetDocument") + " <strong>" + HTMLHelper.HTMLEncode(targetName) + "</strong>";

                switch (action.ToLowerCSafe())
                {
                    case "movenode":
                    case "movenodeposition":
                    case "movenodefirst":
                        // Setup page title text and image
                        ctlAsyncLog.TitleText = GetString("ContentRequest.StartMove");
                        canceledString = "ContentRequest.MoveCanceled";
                        headQuestion.Text = GetString("ContentMove.Question");
                        chkCopyPerm.Text = GetString("contentrequest.preservepermissions");
                        break;

                    case "copynode":
                    case "copynodeposition":
                    case "copynodefirst":
                        // Setup page title text and image
                        ctlAsyncLog.TitleText = GetString("ContentRequest.StartCopy");
                        canceledString = "ContentRequest.CopyingCanceled";
                        childNodes = chkChild.Checked;
                        plcCopyCheck.Visible = node.NodeHasChildren;
                        chkChild.ResourceString = "contentrequest.copyunderlying";

                        headQuestion.Text = GetString("ContentCopy.Question");
                        chkCopyPerm.Text = GetString("contentrequest.copypermissions");
                        break;

                    case "linknode":
                    case "linknodeposition":
                    case "linknodefirst":
                        // Setup page title text and image
                        ctlAsyncLog.TitleText = GetString("ContentRequest.StartLink");
                        canceledString = "ContentRequest.LinkCanceled";
                        childNodes = chkChild.Checked;
                        plcCopyCheck.Visible = node.NodeHasChildren;
                        chkChild.ResourceString = "contentrequest.linkunderlying";

                        headQuestion.Text = GetString("ContentLink.Question");
                        chkCopyPerm.Text = GetString("contentrequest.copypermissions");
                        break;

                    default:
                        ShowError(GetString("error.notsupported"));
                        pnlAction.Visible = false;
                        break;
                }
            }
            else
            {
                // Hide everything
                pnlContent.Visible = false;
            }
//.........这里部分代码省略.........
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:101,代码来源:DragOperation.ascx.cs


注:本文中的TreeNode.IsRoot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。