Kuv twb tau ua hauj lwm rau dab tsi kuv vam yuav muaj sai-tso CodePlex teg num npaaj zoo integrated me ntsis ntawm cov Web site qhov neb sib tham tsis tau ntawm tus neeg zov me nyuam los muab siv sib txuas lawv kawm ua ib qhov chaw SharePoint nyob rau hauv daim npog. (Qhov no yeej tau tau ua ntej, tab sis qhov no yog kev kawm project ntau li ntau dabtsi ntxiv). Qhov no yog meant yuav ib daim tuaj hloov rau lub qhov rais explorer saib ntawm SharePoint 2010 daim ntawv qiv.
Cov cai no muaj li ib txwm recursive hu mus rau nram lub SPWeb thiab SPLists tus zauv pib taw tes. Cov kwv yog cov ntawd traversing leem tus hlua XML uas zoo li tej yam zoo li no:
<sitecollection url =’http://demo2010a:9090′>
<Web site
Title = 'Nyob zoo ntiaj teb Sandbox'
Template =' tus kawm ntawv nrog ceev nrooj miv, sau, thiab muab lus qhia, BLAH BLAH BLAH'>
<sau
Title ='BCC_Health_Services_FAQs’
Template ='CustomList’
listid =’http://demo2010a:9090/helloworldsandbox[delim]1e02b001-3cb2-4f17-b63d-7809e86b4174′>
</sau>
<sau
Title = 'BCC_Notifications'
Template = 'CustomList'
listid =’http://demo2010a:9090/helloworldsandbox[delim]5a5a13d1 - 877c - 41c 0-9063-b9612be80d5e’>
</sau>
</Web site>
</sitecollection>
Kuv mam los ntxuav tu uas XML ua ntej txhua yam yog hais thiab ua.
Kuv xav kom thaum kawg tau cov lus qhia ntawd mus thiab mus ua tus Treeview tswj. Tsis raws nraim earth shattering khoom.
Kev xwb yuab kuv muab rau koj yog coj mus cuag cov ntoo pom los tiv thaiv XML tej ntaub ntawv los siv manually tsev li kuv treenodes raws li kuv traverse rau tsob ntoo. Kuv puas no tej vim kuv tabtom txhob txwm tshaj tawm ua tej yam nyuaj rau kuv tus kheej (qhov no nws yog ib qhov project rua suav) thiab tej vim kuv muaj qhov vague notion uas tsev nce ntoo o li tsob ntoo traverse kuv tsis yog ib lub tswv yim zoo rau lub sij hawm ntev.
Qhov teeb meem nrog cov kauj yog tias cov Treeview tswj tsis paub txog qhov zoo muab rau hauv cov ntshav nthuav xws li "sau" los yog "Web site" kom nws pom tias cov zis no los vim:
Yog tsis pab. Qhov no yog qhov chaw rau cov hoob kawm TreeNodeBinding pab. Kuv siv tau qhov no qhia rau cov tswj Treeview li cas yuav tsum txhais rau XML. Ntawm no yog ib qho piv txwv:
tnb = TreeNodeBinding tshiab();
tnb.DataMember = "sau"; // Qhov no nws yog cov ntawv sau nyob hauv lub xml rau ib qhov chaw.
tnb.TargetField = "listid";
tnb.ValueField = "title";
tnb.ToolTipField = "Template";
No losis tswvyim dabtsi qhia rau treeview tias thaum nws pom ib tug <sau> ntawm nyob rau hauv cov XML, siv cov nabkaus rau TargetField, ValueField thiab ToolTipField. Nyob hauv ntuj app, cov map raws li nram no:
- TargetField: Thaum ib tug neeg clicks nyob rau ib cov nqi ntawm, qhov no yog koj yuav tau dab tsi rau SelectedNode.Value. Yog li no tsis yog tsis meej pem nrog...
- ValueField: Qhov no yog dab tsi koj xav qhov Treeview los tso saib kom tus neeg siv.
- ToolTipField: Tus nqi ntawm cov XML uas koj xav ua ib Tooltip.
Ntxiv tias TreeNodebinding ntoo pom cov DataBindings thiab koj tau output li no:
Kuv mam muaj ntau rau txhua yam no ntxiv rau peb tes num thiab nws thiaj li muab qhov no rau Codeplex.
</kawg>
Subscribe rau kuv blog.
Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin