精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。”需要全文内容也请联系孙老师。中文译文
ASP.NET Treeview control is the most used server control for representing tree view hierarchy data structure. Most of the time, we get requirements related to hierarchical tree structure of data representation; this becomes more complicated and complex if we've depth of leaf node to extreme extent. In such scenarios, we may have to look at generic solution. This article will help a developer to use the below logic or implementation to tackle similar situations.
Say for example, we've business problem statement of representing certain family or category in hierarchical fashion. In such case, iteration through XML tree or structured database becomes a challenge. Even parsing is one part of the problem and then representing it in graphical view of that hierarchy pattern.
Note: Here, the challenge is data structure are not hardcoded and any point of time new leaf node or parent node may be added at runtime. Hence having XML structure will be bit challenge as parsing, locating parent node and updating XML data will put additional overhead on programmer.
Approach to be followed:
Important contributing factors are here to create well data table structure and binding it to tree view control.
Create Stored procedure ssp_get_hierarchy: This will give Node_ID its child information and level or depth of leaf node or branch it belongs to.The below is the result set of the above stored procedure. The best use of Common table expression in SQL Server 2005 to refer recursive dataset using WITH Clause