欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

ASP.NET中TreeView的作用是什么

本篇文章給大家分享的是有關ASP.NET中TreeView的作用是什么,小編覺得挺實用的,因此分享給大家學習,希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

專注于為中小企業(yè)提供成都網(wǎng)站設計、成都網(wǎng)站制作服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)弋陽免費做網(wǎng)站提供優(yōu)質的服務。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上1000家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設實現(xiàn)規(guī)模擴充和轉變。

ASP.NET 2.0 的 TreeView 控件功能雖說強大,但其客戶端控制很遜色,本文將講解 TreeView 的客戶端實現(xiàn)原理,并實現(xiàn)兩個個性化操作:

(1) 節(jié)點的全部打開和關閉;
Client Side Expand/Collapse All Nodes For ASP.NET 2.0 TreeView.

(2) 只打開一個節(jié)點(關閉其他兄弟節(jié)點)。
Just one expanded node in ASP.NET 2.0 TreeView (When a client expand one node all other will collaps)
用記事本打開頁面源代碼,可以找到一下兩個腳本引用:

  1. <script src="/WebUI/WebResource.axd?d=RAQeBcDUNuP9iuS8q3tNEw2&amp;
    t=633300220640000000" type="text/javascript"></script> 

  2. <script src="/WebUI/WebResource.axd?d=JuTdJhq3NM8Jq_RhssAkEg2&amp;
    t=633300220640000000" type="text/javascript"></script> 


將"/WebUI/WebResource.axd?d=RAQeBcDUNuP9iuS8q3tNEw2& amp;t=633300220640000000"拷到地址欄尾,下載腳本,并以 .js 命名,另一個同樣操作。分析第二個腳本文件,可以看到TreeView的很多客戶端函數(shù),其中關鍵的一個 TreeView_ToggleNode 就是客戶端點擊時觸發(fā)的事件。

要想做個性化的操作,就得從 TreeView_ToggleNode 事件下手。我們無法更改.net封裝好的腳本,只有“重寫”。所謂的重寫就是在原來的函數(shù)之后添加一個同名函數(shù)(因為js對于同名函數(shù)只調(diào)用***一個)。

TreeView_ToggleNode 的原函數(shù):

  1. function TreeView_ToggleNode(data, index, node, lineType, children) {  

  2. var img = node.childNodes[0];  

  3. var newExpandState;  

  4. try {  

  5. if (children.style.display == "none") {  

  6. children.style.display = "block";  

  7. newExpandState = "e";  

  8. if ((typeof(img) != "undefined") && (img != null)) {  

  9. if (lineType == "l") {  

  10. img.src = data.images[15];  

  11. }  

  12. else if (lineType == "t") {  

  13. img.src = data.images[12];  

  14. }  

  15. else if (lineType == "-") {  

  16. img.src = data.images[18];  

  17. }  

  18. else {  

  19. img.src = data.images[5];  

  20. }  

  21. img.alt = data.collapseToolTip.replace(/\{0\}/, TreeView_GetNodeText(node));  

  22. }  

  23. }  

  24. else {  

  25. children.style.display = "none";  

  26. newExpandState = "c";  

  27. if ((typeof(img) != "undefined") && (img != null)) {  

  28. if (lineType == "l") {  

  29. img.src = data.images[14];  

  30. }  

  31. else if (lineType == "t") {  

  32. img.src = data.images[11];  

  33. }  

  34. else if (lineType == "-") {  

  35. img.src = data.images[17];  

  36. }  

  37. else {  

  38. img.src = data.images[4];  

  39. }  

  40. img.alt = data.expandToolTip.replace(/\{0\}/, TreeView_GetNodeText(node));  

  41. }  

  42. }  

  43. }  

  44. catch(e) {}  

  45. datadata.expandState.value =  data.expandState.value.substring(0, index) + 
    newExpandState + data.expandState.value.slice(index + 1);  

以上就是ASP.NET中TreeView的作用是什么,小編相信有部分知識點可能是我們?nèi)粘9ぷ鲿姷交蛴玫降摹OM隳芡ㄟ^這篇文章學到更多知識。更多詳情敬請關注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

新聞名稱:ASP.NET中TreeView的作用是什么
標題路徑:http://www.chinadenli.net/article30/piiiso.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作營銷型網(wǎng)站建設域名注冊網(wǎng)站營銷建站公司標簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

綿陽服務器托管