Apr 06, 2013, 6:14 AM
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.