Help!!How to set the CustomAttributes' value codebehind!!

  1. #1

    Help!!How to set the CustomAttributes' value codebehind!!

    Hello,I have build a TreePanel codebehind,the code is like this:
     <ext:TreePanel 
                            ID="TreePanel1" 
                            runat="server" 
                            Title="Privileges List"
                            Icon="Accept"
                            UseArrows="true"
                            AutoScroll="true"
                            Animate="true"            
                            RootVisible="false">
                            <Fields>
                                <ext:ModelField Name="Function" />   
                                <ext:ModelField Name="New" Type="Boolean" />
                                <ext:ModelField Name="Edit" Type="Boolean" />
                                <ext:ModelField Name="Delete" Type="Boolean" />
                            </Fields>
                            <ColumnModel>
                                <Columns>
                                    <ext:TreeColumn ID="TreeColumn1" runat="server" Text="Function Name" Flex="2"
                                        DataIndex="Function" />
                                    <ext:CheckColumn ID="CheckColumn1" runat="server" Text="New" DataIndex="New" Width="60" Align="Center"
                                        Editable="true" StopSelection="false" />
                                    <ext:CheckColumn ID="CheckColumn2" runat="server" Text="Edit" DataIndex="Edit" Width="60"
                                        Align="Center" Editable="true" StopSelection="false" />
                                    <ext:CheckColumn ID="CheckColumn3" runat="server" Text="Delete" DataIndex="Delete"
                                        Align="Center" Width="60" Editable="true" StopSelection="false" />                    
                                </Columns>
                            </ColumnModel>
    And I build the nodes codebehind::
                    foreach (DataRow row in systemConfigRows)
                    {
                        Ext.Net.Node node = new Ext.Net.Node()
                        {
                            Text = row["FUNCTION_NAME"].ToString(),
                            Leaf = true,
                            Checked = false
                        };
                        node.NodeID = row["FUNCTION_ID"].ToString();
    
                        ConfigItem configNmae = new ConfigItem();                    
                        configNmae.Name = "Function";
                        configNmae.Value = node.Text;
                        configNmae.Mode = ParameterMode.Value;
                        node.CustomAttributes.Add(configNmae);
    
                        ConfigItem configNew = new ConfigItem();
                        configNew.Name = "New";
                        configNew.Value = "0";
                        configNew.Mode = ParameterMode.Value;
                        node.CustomAttributes.Add(configNew);
    
                        ConfigItem configEdit = new ConfigItem();
                        configEdit.Name = "Edit";
                        configEdit.Value = "0";
                        configEdit.Mode = ParameterMode.Value;
                        node.CustomAttributes.Add(configEdit);
    
                        ConfigItem configDelete = new ConfigItem();
                        configDelete.Name = "Delete";
                        configDelete.Value = "0";
                        configDelete.Mode = ParameterMode.Value;
                        node.CustomAttributes.Add(configDelete);
    
                        systemConfigRoot.Children.Add(node);
                    }
    but the problem has came,When I want to set the value of the ConfigItem ,I can't find them,how can I do it?,this's the code:
                        NodeProxy nodeProy = TreePanel1.GetNodeById(row["FUNCTION_ID"].ToString());
                        
                        nodeProy.Set("checked", true);
    
                        
    
                        if (row["NEW"].ToString() == "1")
                        {                        
                            nodeProy.CustomConfig[1].Value = "1";
                        }
    I can get the node,but "nodeProy.CustomConfig" has no customConfig,when I do it as this way,it will alert the "over range" exception.
  2. #2
    Just use Set method
    nodeProy.Set("New", "1");

Similar Threads

  1. Why Can't get TreePanel CustomAttributes
    By zhurui124 in forum 2.x Help
    Replies: 6
    Last Post: Mar 29, 2013, 2:38 AM
  2. [CLOSED] Edit Column in Tree (CustomAttributes)
    By romeu in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 02, 2012, 11:47 AM
  3. Replies: 1
    Last Post: Dec 04, 2011, 10:01 AM
  4. [CLOSED] [8.2] TreeNode CustomAttributes
    By HOWARDJ in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 11, 2010, 9:19 AM
  5. [CLOSED] TreeNode and its CustomAttributes
    By gokcemutlu in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 02, 2009, 7:02 AM

Posting Permissions