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


C# TreeNode.Select方法代码示例

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


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

示例1: AddNodes

    // 用遞迴方式建立 Nodes
    private void AddNodes(ref TreeNode pNode, ref DataTable dt_Al_List, int up_al_sid)
    {
        DataRow[] dRow = dt_Al_List.Select("up_al_sid = " + up_al_sid.ToString());

        // 如果有資料,則建立子節點
        if (dRow.GetUpperBound(0) > -1)
        {
            TreeNode subNode;

            foreach (DataRow sRow in dRow)
            {
                subNode = new TreeNode();

                if (sRow[0].ToString() == lb_al_sid.Text)
                {
                    subNode.Select();
                }

                subNode.Text = sRow[2].ToString();
                subNode.Value = sRow[0].ToString();

                subNode.NavigateUrl = "3001.aspx?al_sid=" + sRow[0].ToString();
                subNode.Target = "_parent";
                subNode.ToolTip = sRow[3].ToString();
                pNode.ChildNodes.Add(subNode);

                AddNodes(ref subNode, ref dt_Al_List, int.Parse(sRow[0].ToString()));
            }
            dRow = null;
        }
    }
开发者ID:fping1245,项目名称:test20121224,代码行数:32,代码来源:30011.aspx.cs

示例2: BindTree

    private void BindTree()
    {
        //获取品牌
        string brandcondition = "";
        if (Request.QueryString["IsOpponent"] != null)
        {
            if (Request.QueryString["IsOpponent"] == "10")
                brandcondition = "IsOpponent IN (1,9)";
            else
                brandcondition = "IsOpponent=" + Request.QueryString["IsOpponent"];
        }
        else
        {
            if ((int)Session["OwnerType"] == 2) brandcondition = "IsOpponent='1'";
        }
        IList<PDT_Brand> _brands = PDT_BrandBLL.GetModelList(brandcondition);

        foreach (PDT_Brand brand in _brands)
        {
            TreeNode tn_brand = new TreeNode(brand.Name, brand.ID.ToString());
            tr_Product.Nodes.Add(tn_brand);

            string ConditionStr = "PDT_Product.State = 1 AND PDT_Product.ApproveFlag = 1 AND PDT_Product.Brand = " + brand.ID.ToString();

            if ((int)Session["OwnerType"] == 2)
            {
                ConditionStr += "  AND PDT_Product.OwnerType = 2 AND PDT_Product.OwnerClient =" + Session["OwnerClient"].ToString();
            }
            else if ((int)Session["OwnerType"] == 1)
            {
                ConditionStr += "  AND PDT_Product.OwnerType IN (1, 2) ";
            }

            if (Request.QueryString["ExtCondition"] != null)
            {
                ConditionStr += " AND (" + Request.QueryString["ExtCondition"].Replace("\"", "").Replace('~', '\'') + ")";
            }

            IList<PDT_Product> _products = PDT_ProductBLL.GetModelList(ConditionStr);
            foreach (PDT_Product product in _products)
            {
                TreeNode tn = new TreeNode();
                tn.Text = product.FactoryCode + "  " + product.FullName;
                tn.Value = product.ID.ToString();
                tn_brand.ChildNodes.Add(tn);

                if (tn.Value == ViewState["ID"].ToString())
                {
                    tn_brand.Expand();
                    tn.Select();
                    tbx_SelectedProductID.Text = tn.Value;
                    tbx_SelectedProductName.Text = tn.Text;
                }
            }

        }
    }
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:57,代码来源:Pop_Search_Product.aspx.cs

示例3: BindTree

    private void BindTree()
    {
        //获取品牌
        string condition = "";
        if (Request.QueryString["IsOpponent"] != null)
            condition = "IsOpponent=" + Request.QueryString["IsOpponent"];

        IList<PDT_Brand> _brands = PDT_BrandBLL.GetModelList(condition);

        foreach (PDT_Brand brand in _brands)
        {
            TreeNode tn_brand = new TreeNode(brand.Name, brand.ID.ToString());
            tr_Product.Nodes.Add(tn_brand);

            IList<PDT_Classify> _classifys = new PDT_ClassifyBLL()._GetModelList("PDT_Classify.Brand=" + brand.ID.ToString());
            foreach (PDT_Classify classify in _classifys)
            {
                TreeNode tn_classify = new TreeNode(classify.Name, classify.ID.ToString());
                tn_brand.ChildNodes.Add(tn_classify);

                IList<PDT_Product> _products = new PDT_ProductBLL()._GetModelList("PDT_Product.State = 1 AND PDT_Product.Classify=" + classify.ID.ToString());
                foreach (PDT_Product product in _products)
                {
                    TreeNode tn = new TreeNode();
                    tn.Text = product.Code + "  " + product.FullName;
                    tn.Value = product.Code;
                    tn_classify.ChildNodes.Add(tn);

                    if (tn.Value == ViewState["ERPCode"].ToString())
                    {
                        tn_classify.Expand();
                        tn.Select();
                        tbx_SelectedProductCode.Text = tn.Value;
                        tbx_SelectedProductName.Text = tn.Text;
                    }
                }

            }
        }
    }
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:40,代码来源:Serarch_SelectProduct.aspx.cs

示例4: BuildCodexMenu

    /// <summary>
    /// Recursively adds nodes to the treeview menu starting at a given set of peers of a parent node.
    /// </summary>
    /// <param name="nodes">The root treenode collection to which to add child cnodes</param>
    /// <param name="parentCodexRecordId">The parent node record's ID, used to fetch the children</param>
    private void BuildCodexMenu( TreeNodeCollection nodes, int parentCodexRecordId )
    {
        CodexRecordList list = parentCodexRecordId > 0 ? CodexRecordList.GetCodexRecordList( parentCodexRecordId ) : CodexRecordList.GetCodexRecordList();

        //no child nodes (parent will always be included), exit function
        if ( list.Count < 2 ) return;

        foreach ( CodexRecord record in list )
        {
            if ( record.ID == parentCodexRecordId || ( parentCodexRecordId == 0 && record.ParentCodexRecordID != 0 ) ) continue;

            TreeNode node = new TreeNode( record.Title, record.ID.ToString() );

            // automatically select the first root node
            if ( record.ParentCodexRecordID == 0 && CodexMenu.SelectedNode == null ) node.Select();

            nodes.Add( node );
            node.ToggleExpandState();

            BuildCodexMenu( node.ChildNodes, record.ID );
        }
    }
开发者ID:TertiumQuid,项目名称:Aphelion-Trigger,代码行数:27,代码来源:Index.aspx.cs

示例5: AddNodes

    // 用遞迴方式建立 Nodes
    private void AddNodes(ref TreeNode pNode, string up_fl_path)
    {
        string furl = "", ftext;

        // 如果有資料,則建立子節點
        if (Directory.Exists(up_fl_path))
        {
            TreeNode subNode;

            foreach (string fpath in Directory.GetDirectories(up_fl_path))
            {
                furl = fpath.Replace(lb_path.Text, "").Replace("\\", "/");

                // _thumb 為縮圖存放目錄,不顯示
                if (! furl.Contains("_thumb"))
                {
                    subNode = new TreeNode();

                    if (lb_fl_url.Text == (Album.Root + furl))
                    {
                        subNode.Select();
                    }

                    ftext = fpath.Replace(up_fl_path, "").Replace("\\", "");

                    subNode.Text = ftext;
                    subNode.Value = ftext;

                    subNode.NavigateUrl = "3002.aspx?fl_url=" + Server.UrlEncode(dcode.EnCode(Album.Root + furl));
                    subNode.Target = "_parent";
                    subNode.ToolTip = furl;
                    pNode.ChildNodes.Add(subNode);

                    AddNodes(ref subNode, fpath);
                }
            }
        }
    }
开发者ID:fping1245,项目名称:test20121224,代码行数:39,代码来源:30021.aspx.cs

示例6: BindTree

    private void BindTree()
    {
        //获取品牌
        string condition = "";
        if (Request.QueryString["IsOpponent"] != null)
            condition = "IsOpponent=" + Request.QueryString["IsOpponent"];

        IList<PDT_Brand> _brands = PDT_BrandBLL.GetModelList(condition);

        dl_brand.DataSource = _brands;
        dl_brand.DataBind();
        dl_brand.Items.Insert(0, new ListItem("请选择", "0"));
        dl_brand_SelectedIndexChanged(null, null);

        foreach (PDT_Brand brand in _brands)
        {
            TreeNode tn_brand = new TreeNode(brand.Name, brand.ID.ToString());
            tr_Product.Nodes.Add(tn_brand);
            IList<PDT_Classify> _classifys = new PDT_ClassifyBLL()._GetModelList("PDT_Classify.Brand=" + brand.ID.ToString());
            foreach (PDT_Classify classify in _classifys)
            {
                TreeNode tn_classify = new TreeNode(classify.Name, classify.ID.ToString());
                tn_brand.ChildNodes.Add(tn_classify);

                string ConditionStr = "PDT_Product.State = 1 AND PDT_Product.Classify=" + classify.ID.ToString()+"and pdt_product.approveflag=1";
                if (Request.QueryString["ExtCondition"] != null)
                {
                    ConditionStr += " AND (" + Request.QueryString["ExtCondition"].Replace("\"", "").Replace('~', '\'') + ")";
                }

                IList<PDT_Product> _products = PDT_ProductBLL.GetModelList(ConditionStr);
                foreach (PDT_Product product in _products)
                {
                    TreeNode tn = new TreeNode();
                    tn.Text = product.Code + "  " + product.FullName;
                    tn.Value = product.ID.ToString();
                    tn_classify.ChildNodes.Add(tn);

                    if (tn.Value == ViewState["ID"].ToString())
                    {
                        tn_classify.Expand();
                        tn.Select();
                        tbx_SelectedProductID.Text = tn.Value;
                        tbx_SelectedProductName.Text = tn.Text;
                    }
                }

            }
        }
    }
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:50,代码来源:Pop_Search_Product.aspx.cs

示例7: BuildTreeView

    // 建立 TreeView
    private void BuildTreeView()
    {
        TreeNode RootNode = new TreeNode();         //根節點

        RootNode.Text = "根目錄";
        RootNode.Value = "0";
        RootNode.ToolTip = "";
        RootNode.NavigateUrl = "3002.aspx?fl_url=" + Server.UrlEncode(dcode.EnCode(Album.Root));
        RootNode.Target = "_parent";

        if (lb_fl_url.Text == Album.Root)
            RootNode.Select();

        tv_Al_List.Nodes.Clear();
        tv_Al_List.Nodes.Add(RootNode);
        tv_Al_List.ExpandAll();

        AddNodes(ref RootNode, lb_path.Text);
    }
开发者ID:fping1245,项目名称:test20121224,代码行数:20,代码来源:30021.aspx.cs

示例8: botSaveModelo_Click

    protected void botSaveModelo_Click(object sender, EventArgs e)
    {
        // parte geral
        ModeloCompetencias selModelo;
        selModelo = (ModeloCompetencias)Session["selectedObject"];
        selModelo.PublicName = this.txtNome.Text;
        selModelo.Name = this.txtNomeBreve.Text;
        selModelo.Description = Context.Server.HtmlEncode(this.txtDescricao.Text);
        selModelo.IntroText = Context.Server.HtmlEncode(this.txtIntroducao.Text);
        selModelo.CommentsText = Context.Server.HtmlEncode(this.txtIntroducaoComments.Text);
        selModelo.AllowRespondentComments = this.chkComments.Checked;
        selModelo.Scale = this.txtModeloEscala.Text;
        selModelo.ScaleDesc = Context.Server.HtmlEncode(this.txtModeloEscalaDesc.Text);
        selModelo.ModelType = this.txtTipoModelo.Text;
        selModelo.NR = chkNR_Modelo.Checked;
        // parte específica

        // grava
        selModelo.updateDBModelo("JC");
        String mode="";
        if (Session["mode"] != null)
            mode = (String)Session["mode"];

        modelos = (SortedList<int, ModeloCompetencias>)Session["modelos"];

        if (mode == "ADD_NEW")
        {
            TreeNode n1 = new TreeNode(selModelo.Name, selModelo.ModeloID.ToString());
            ModelTree.Nodes.Add(n1);
            modelos.Add(selModelo.ModeloID, selModelo);
            Session.Remove("mode");
            n1.Select();
            //n1.Expand();
        }
        else if (mode.StartsWith("DUPLICATE"))
        {
            //String[] dup = mode.Split(';');
            //String modelToDuplicate = dup[1];
            //ModeloCompetencias.duplicateModelo(int.Parse(modelToDuplicate), selModelo.ModeloID);

            TreeNode n1 = new TreeNode(selModelo.Name, selModelo.ModeloID.ToString());
            ModelTree.Nodes.Add(n1);
            modelos.Add(selModelo.ModeloID, selModelo);
            Session.Remove("mode");
            n1.PopulateOnDemand = true;
            n1.Select();
        }
        else
        {
            // actualiza a árvore de menus
            TreeNode theNode = ModelTree.FindNode(selModelo.ModeloID.ToString());
            theNode.Text = selModelo.Name;
            modelos[selModelo.ModeloID] = selModelo;
        }
        Session["modelos"] = modelos;
        Session["currModelo"] = currModelo;
        Session["selectedObject"] = currModelo;

        if (currModelo.ScaleDesc == "RANDOM")
        {
            currModelo.randomPerguntas();
            currModelo.ScaleDesc = "RANDOMIZED";
            currModelo.updateDBModelo("JC");
        }
    }
开发者ID:JCanhoto,项目名称:ToolsQtools,代码行数:65,代码来源:GestaoModelos.aspx.cs

示例9: buildSub

        //int CompareFolder(SPFolder f1, SPFolder f2)
        //{
        //    return f1.Name.CompareTo(f2.Name);
        //}
        //�����ļ�����
        void buildSub(string pageUrl, string webUrl , string currentFolderUrl ,  SPFolder root, TreeNodeCollection nodes)
        {
            if (root.SubFolders.Count == 0) return;

            IList<SPFolder> sortedFolders = this.GetSortedSubFolders(root);

            foreach (SPFolder f in sortedFolders )
            {
                //if (  f.Name.ToLower() == "forms") continue;

                if (IsHiddenFolder(f)) continue;

                string folderUrl = webUrl + f.Url;

                TreeNode n = new TreeNode();

               // string url = webUrl + pageUrl + "?RootFolder=" + folderUrl ;// + Page.Server.UrlEncode(folderUrl);

               // n.NavigateUrl = "javascript:SubmitFormPost( '"+pageUrl+"' + encodeURIComponent('" + f.Url + "') );"; //EnterFolder and SubmitFormPost��ϵͳjs

                n.NavigateUrl = pageUrl + Page.Server.UrlEncode(folderUrl);

                //n.Expanded = Expanded ;
                n.ImageUrl = "/_layouts/images/folder.gif";
                nodes.Add(n);

                if (String.Compare(currentFolderUrl, folderUrl, true) == 0) //չ�����и�
                {
                    n.Expand();
                    TreeNode temp = n.Parent;
                    while (temp != null)
                    {
                        temp.Expand();
                        temp = temp.Parent;
                    }
                    n.Select();
                    //n.Text = "<b>" + f.Name + "</b>(" + f.Files.Count + ")";

                    n.Text = "<b>" + f.Name + "</b>";
                }
                else
                {
                    //n.Collapse();
                    n.Text = f.Name ;
                }

                //n.Text = "<a href='"+url+"' onclick=\"javascript:EnterFolder('" + url + "');return false;\">" + n.Text + "<a>";

                buildSub(pageUrl, webUrl , currentFolderUrl , f, n.ChildNodes);
            }
        }
开发者ID:porter1130,项目名称:C-A,代码行数:56,代码来源:ListTreeViewWebPart.cs

示例10: showNode

 private void showNode(TreeNode treeNode)
 {
     treeNode.Select();
     while (treeNode.Parent != null)
     {
         treeNode = treeNode.Parent;
         treeNode.Expand();
     }
 }
开发者ID:groupdocs-total,项目名称:dnn-groupdocs-viewer-source,代码行数:9,代码来源:Settings.ascx.cs

示例11: treeCategory_NodeExpanded

 protected void treeCategory_NodeExpanded(object sender, TreeNodeEventArgs e)
 {
     if (e.Node.ChildNodes.Count > 0 && e.Node.ChildNodes[0].Value == "NULL_NODE") {
         e.Node.ChildNodes.RemoveAt(0);
         if (e.Node.Depth == 0) {
             int catalogId = int.Parse(e.Node.Value);
             var catalog = UCommerce.EntitiesV2.ProductCatalog.All().SingleOrDefault(cata => cata.ProductCatalogId == catalogId);
             if (catalog != null) {
                 foreach (var category in catalog.Categories.Where(cate => cate.ParentCategory == null && !cate.Deleted)) {
                     TreeNode catNode = new TreeNode(category.Name, category.CategoryId.ToString());
                     catNode.ImageUrl = "/umbraco/images/umbraco/folder.gif";
                     e.Node.ChildNodes.Add(catNode);
                     if (category.Categories.Count > 0) {
                         catNode.ChildNodes.Add(new TreeNode("", "NULL_NODE"));
                     }
                     if(catNode.Value == _umbracoValue)
                         catNode.Select();
                 }
             }
         }
         if(e.Node.Depth > 0) {
             int categoryId = int.Parse(e.Node.Value);
             var category = UCommerce.EntitiesV2.Category.All().SingleOrDefault(cate => cate.CategoryId == categoryId);
             if(category != null) {
                 foreach(var subCat in category.Categories) {
                     TreeNode catNode = new TreeNode(subCat.Name, subCat.CategoryId.ToString());
                     catNode.ImageUrl = "/umbraco/images/umbraco/folder.gif";
                     e.Node.ChildNodes.Add(catNode);
                     if(subCat.Categories.Count > 0) {
                         catNode.ChildNodes.Add(new TreeNode("", "NULL_NODE"));
                     }
                     if(catNode.Value == _umbracoValue)
                         catNode.Select();
                 }
             }
         }
     }
 }
开发者ID:kevinblake,项目名称:uCommerce-Datatypes,代码行数:38,代码来源:Category.ascx.cs

示例12: BuildTreeView

    // 建立 TreeView
    private void BuildTreeView()
    {
        TreeNode RootNode = new TreeNode();         //根節點

        RootNode.Text = "根目錄";
        RootNode.Value = "0";
        RootNode.ToolTip = "";
        RootNode.NavigateUrl = "3001.aspx?al_sid=0";
        RootNode.Target = "_parent";

        if (lb_al_sid.Text == "0")
            RootNode.Select();

        tv_Al_List.Nodes.Clear();
        tv_Al_List.Nodes.Add(RootNode);
        tv_Al_List.ExpandAll();

        using (SqlConnection Sql_Conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["AppSysConnectionString"].ConnectionString))
        {
            Sql_Conn.Open();

            string SqlString = "";

            SqlString = "Select al_sid, up_al_sid, al_name, al_desc From Al_List Order by up_al_sid, al_sort";

            using (SqlCommand Sql_Command = new SqlCommand(SqlString, Sql_Conn))
            {
                using (SqlDataAdapter Sql_Adapter = new SqlDataAdapter(Sql_Command))
                {
                    DataTable dt_Al_List = new DataTable();

                    Sql_Adapter.Fill(dt_Al_List);

                    // 用遞迴方式建立 Nodes
                    AddNodes(ref RootNode, ref dt_Al_List, 0);

                    dt_Al_List.Clear();
                    dt_Al_List.Dispose();
                }
            }
            Sql_Conn.Close();
        }
    }
开发者ID:fping1245,项目名称:test20121224,代码行数:44,代码来源:30011.aspx.cs

示例13: Page_Load

        protected void Page_Load( object sender, EventArgs e )
        {
            Response.Cache.SetCacheability( HttpCacheability.NoCache );

            ScriptsManager.RegisterJQuery(Page);

            if( !IsPostBack )
            {
                TreeNode root = new TreeNode( "Библиотека документов", "0" );
                root.SelectAction = TreeNodeSelectAction.SelectExpand;
                root.ImageUrl = "~/Controls/FileManager/root.gif";
                _treeView.Nodes.Add( root );

                using (var dc = new DCFactory<CmsDataContext>())
                {
                    AddChildren( root, dc.DataContext.Folders.Where( f => f.ParentID == null ).OrderBy( f => f.FolderName ).ToArray() );
                }

                _treeView.CollapseAll();
                root.Expand();
                root.Select();
            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:23,代码来源:FileManagerControl.ascx.cs

示例14: botSavePratica_Click

    protected void botSavePratica_Click(object sender, EventArgs e)
    {
        // parte geral
        Pratica selPratica;
        selPratica = (Pratica)Session["selectedObject"];
        selPratica.PublicName = this.txtNome.Text;
        selPratica.Name = this.txtNomeBreve.Text;

        selPratica.Description = Context.Server.HtmlEncode(this.txtDescricao.Text);
        selPratica.IntroText = Context.Server.HtmlEncode(this.txtIntroducao.Text);
        selPratica.CommentsText = Context.Server.HtmlEncode(this.txtIntroducaoComments.Text);
        selPratica.AllowRespondentComments = this.chkComments.Checked;

        // parte específica
        selPratica.Criticalidade = this.chkCriticPratica.Checked;
        selPratica.CriticalidadeScale = Context.Server.HtmlEncode(this.txtCriticPratEscala.Text);
        selPratica.CriticalidadeText = Context.Server.HtmlEncode(this.txtCriticPratDescrEscala.Text);
        selPratica.NR = chkNR.Checked;

        // grava na base de dados
        selPratica.updateDBPratica("JC");
        String mode = "";
        if (Session["mode"] != null)
            mode = (String)Session["mode"];

        modelos = (SortedList<int, ModeloCompetencias>)Session["modelos"];
        Competencia currCompetencia = selPratica.Competencia;
        FamiliaCompetencias currFamilia = currCompetencia.Familia;

        currModelo = modelos[currFamilia.Modelo.ModeloID];
        // actualiza a árvore de menus
        if (mode == "ADD_NEW")
        {
            TreeNode n1 = new TreeNode(selPratica.Name, selPratica.PraticaID.ToString());
            ModelTree.FindNode(currModelo.ModeloID.ToString() + "|"
                                + currFamilia.FamiliaID.ToString() + "|"
                                + currCompetencia.CompetenciaID.ToString()).ChildNodes.Add(n1);
            currCompetencia.addPratica(selPratica);
            currFamilia.updateCompetencia(currCompetencia);
            currModelo.updateFamilia(currFamilia);
            Session.Remove("mode");
            n1.Select();
            //n1.Expand();

        }
        else
        {
            TreeNode theNode = ModelTree.FindNode(currModelo.ModeloID.ToString() + "|"
                                                    + currFamilia.FamiliaID.ToString() + "|"
                                                    + currCompetencia.CompetenciaID.ToString() + "|"
                                                    + selPratica.PraticaID.ToString());
            theNode.Text = selPratica.Name;
            currCompetencia.updatePratica(selPratica); // actualiza a lista de pratica da competência
            currFamilia.updateCompetencia(currCompetencia); // actualiza a lista de competencias na família
            currModelo.updateFamilia(currFamilia); // actualiza a lista de famílias no modelo
        }

        Session["modelos"] = modelos;
        Session["currModelo"] = currModelo;
        Session["selectedObject"] = selPratica;
    }
开发者ID:JCanhoto,项目名称:ToolsQtools,代码行数:61,代码来源:GestaoModelos.aspx.cs

示例15: botSavePergunta_Click

    protected void botSavePergunta_Click(object sender, EventArgs e)
    {
        // parte geral

        // parte específica
        Pergunta selPergunta;
        selPergunta = (Pergunta)Session["selectedObject"];
        selPergunta.Name = this.txtNomePergunta.Text;
        selPergunta.TextoBase = this.txtTextoPergunta.Text;
        selPergunta.MainSortIndex = this.txtGlobalIndex.Text == "" ? -1 : int.Parse(this.txtGlobalIndex.Text);
        selPergunta.tipoPergunta = this.txtTipoPergunta.Text == "" ? null : this.txtTipoPergunta.Text;
        selPergunta.valor = this.txtValor.Text == "" ? -1 : int.Parse(this.txtValor.Text);
        selPergunta.ponderador = this.txtPonderador.Text == "" ? -1 : float.Parse(this.txtPonderador.Text);
        selPergunta.Codificacao = this.txtCodificacao.Text == "" ? null : this.txtCodificacao.Text;

        // grava na base de dados
        selPergunta.updateDBPergunta("JC");

        String mode = "";
        if (Session["mode"] != null)
            mode = (String)Session["mode"];

        modelos = (SortedList<int, ModeloCompetencias>)Session["modelos"];
        Pratica currPratica = selPergunta.Pratica;
        Competencia currCompetencia = currPratica.Competencia;
        FamiliaCompetencias currFamilia = currCompetencia.Familia;
        currModelo = modelos[currFamilia.Modelo.ModeloID];
        // actualiza a árvore de menus
        if (mode == "ADD_NEW")
        {
            TreeNode n1 = new TreeNode(selPergunta.Name, selPergunta.PerguntaID.ToString());
            ModelTree.FindNode(currModelo.ModeloID.ToString() + "|"
                                + currFamilia.FamiliaID.ToString() + "|"
                                + currCompetencia.CompetenciaID.ToString() + "|"
                                + currPratica.PraticaID.ToString()).ChildNodes.Add(n1);
            currPratica.addPergunta(selPergunta);
            currCompetencia.updatePratica(currPratica);
            currFamilia.updateCompetencia(currCompetencia);
            currModelo.updateFamilia(currFamilia);
            Session.Remove("mode");
            n1.Select();
            //n1.Expand();
        }
        else
        {
            TreeNode theNode = ModelTree.FindNode(currModelo.ModeloID.ToString() + "|"
                                                + currFamilia.FamiliaID.ToString() + "|"
                                                + currCompetencia.CompetenciaID.ToString() + "|"
                                                + currPratica.PraticaID.ToString() + "|"
                                                + selPergunta.PerguntaID.ToString());
            theNode.Text = selPergunta.Name;
            currPratica.updatePergunta(selPergunta);
            currCompetencia.updatePratica(currPratica); // actualiza a lista de pratica da competência
            currFamilia.updateCompetencia(currCompetencia); // actualiza a lista de competencias na família
            currModelo.updateFamilia(currFamilia); // actualiza a lista de famílias no modelo
        }
        Session["modelos"] = modelos;
        Session["currModelo"] = currModelo;
        Session["selectedObject"] = selPergunta;

        // actualiza o preview da pegunta

        this.txtNomePergunta.Text = Context.Server.HtmlDecode(selPergunta.Name);
        this.txtTextoPergunta.Text = Context.Server.HtmlDecode(selPergunta.TextoBase);

        Pessoa p1 = new Pessoa();
        p1.NomeProprio = "Joana";
        p1.NomesMeio = "dos Santos";
        p1.Apelido = "Marques";
        p1.Sexo = "F";
        p1.Email = "aaa";

        Pessoa p2 = new Pessoa();
        p2.NomeProprio = "Vasco";
        p2.NomesMeio = "Manuel";
        p2.Apelido = "Carvalho";
        p2.Sexo = "M";
        p2.Email = "bbb";

        Pessoa p3 = new Pessoa();
        p3.NomeProprio = "Marco";
        p3.NomesMeio = "António";
        p3.Apelido = "Curto";
        p3.Sexo = "M";
        p3.Email = "ccc";

        Pergunta perg = new Pergunta(selPergunta.TextoBase);
        perg.setupPergunta(p1, p1,false);
        this.lblAutoavaliacao.Text = "<p>" + Context.Server.HtmlDecode(perg.GetPerguntaText()) + "</p>";
        Pessoa[] grupo = { p1, p3 };

        perg.setupPergunta(p2, grupo, false);
        this.lblGrupo.Text = "<p>" + Context.Server.HtmlDecode(perg.GetPerguntaText()) + "</p>";

        perg.setupPergunta(p2, p1, false);
        this.lblJoana.Text = "<p>" + Context.Server.HtmlDecode(perg.GetPerguntaText()) + "</p>";

        perg.setupPergunta(p3, p2, false);
        this.lblVasco.Text = "<p>" + Context.Server.HtmlDecode(perg.GetPerguntaText()) + "</p>";
    }
开发者ID:JCanhoto,项目名称:ToolsQtools,代码行数:100,代码来源:GestaoModelos.aspx.cs


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