Friday, April 24, 2015

Migrating from Microsoft.Web.UI to System.Web.Ui - TreeView Control

Hello,

We have an old web project built in NET Framework 1.1.

It uses the TreeView control which is related to Microsoft.Web.UI library.

Now I would like to replace this old, obsolete control by the new one, from System.Web.UI

However there are some functions that I don't find the replacements for.

Ex: This control is populated dynamically from XML file.

<TREENODETYPES>
        <TreeNodeType type="employeur" SelectedImageUrl="Images/ico/18_service.gif" ExpandedImageUrl="Images/ico/18_service.gif" ImageUrl="Images/ico/18_service.gif"/>
        <TreeNodeType type="file" ImageUrl="Images/ico/ico_16_1039_d.gif" ExpandedImageUrl="Images/ico/ico_16_1039_d.gif"/>
        <TreeNodeType type="folder" ImageUrl="Images/ico/closedfolder.gif" ExpandedImageUrl="Images/ico/openedfolder.gif"/>
        <TreeNodeType type="dossiersVue" ImageUrl="Images/ico/closedfolder.gif" ExpandedImageUrl="Images/ico/openedfolder.gif"/>
        <TreeNodeType type="codePaieDossier" ImageUrl="Images/ico/ico_16_1022_d.gif" ExpandedImageUrl="Images/ico/ico_16_1022_d.gif"/>
        <TreeNodeType type="codePaie" ImageUrl="Images/ico/ico_16_1055.gif" ExpandedImageUrl="Images/ico/ico_16_1055.gif"/>
        <TreeNodeType type="CategorieCodePaie" ImageUrl="Images/ico/ico_16_1056.gif" ExpandedImageUrl="Images/ico/ico_16_1056_d.gif"/>
        <TreeNodeType type="texteType" ImageUrl="Images/ico/18_activities.gif" ExpandedImageUrl="Images/ico/18_activities.gif"/>
        <TreeNodeType type="action" ImageUrl="Images/ico/ico_18_news.gif" ExpandedImageUrl="Images/ico/ico_18_news.gif"/>
        <TreeNodeType type="sites" ImageUrl="Images/ico/ada.gif" ExpandedImageUrl="Images/ico/ada.gif"/>
        <TreeNodeType type="cibles" ImageUrl="Images/ico/ico_18_home.gif" ExpandedImageUrl="Images/ico/ico_18_home.gif"/>
</TREENODETYPES>

And in the code we have:

_treeView.TreeNodeTypeSrc = MapPath("NodeTypes.xml");
           
_treeView.DataBind();



...


TreeNode treeNode = new TreeNode();
            
treeNode.Type = "folder";
treeNode.Text = "Gestionnaires";
treeNode.Value = id + "Gestionnaires";

treeNodeParent.ChildNodes.Add(treeNode);

treeNode.Type in code is not available for the new control.

How do I replace it?

No comments:

Post a Comment