av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

淺談ASP.NET中的TreeView

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

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

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

 
 
 
  1.  src="/WebUI/WebResource.axd?d=RAQeBcDUNuP9iuS8q3tNEw2&
    t=633300220640000000"
     type="text/javascript"> 
  2.  src="/WebUI/WebResource.axd?d=JuTdJhq3NM8Jq_RhssAkEg2&
    t=633300220640000000"
     type="text/javascript"> 

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

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

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);  

【編輯推薦】

  1. ASP.NET的TypeConverter
  2. 淺析ASP.NET的TypeResolver
  3. ASP.NET中定義JavaScriptConverter
  4. 在ASP.NET中替換Sys.Services的方法
  5. 使用ASP.NET AJAX的Profile Service

網(wǎng)頁(yè)名稱:淺談ASP.NET中的TreeView
URL鏈接:http://uogjgqi.cn/article/ccsoghp.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們?cè)谖⑿派?4小時(shí)期待你的聲音

解答本文疑問/技術(shù)咨詢/運(yùn)營(yíng)咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流