C # Discovery Tour-high performance asp.net tree list control (medium)

Source: Internet
Author: User
Tags html page html tags xsl xslt

First segment of HTML code block

If the control's "Dynamicloadchildnodes" property value is true, that is, the control runs on a client dynamic load child node, the output supports the HTML code for the client to dynamically load the child nodes, first outputting a named " Skytreeviewcontroltempxml "XML data island label and bind its" onreadystatechange "event to the" Skytreeviewcontroldynamicloadchildnodes " JavaScript functions. A global variable called "Skytreeviewcontroldyanmicrootnodeid" is also defined here to indicate which node is being loaded in the node. The HTML code output here is

<!--





defines an XML data island label


    


uses the XML data island to load the XML document that defines the child nodes when dynamically loading the child nodes,




The
XML data island is an IE-specific technology that other browsers may not support.





-->


<xml id= ' skytreeviewcontroltempxml '


onreadystatechange= ' skytreeviewcontroldynamicloadchildnodes () ' ></xml>


<script language=javascript>





//---------to begin defining JavaScript code to use for dynamically loading child nodes---------------------





//The root node object number of the current dynamically loaded child node


var Skytreeviewcontroldyanmicrootnodeid;





//Dynamic load child node


function Skytreeviewcontroldynamicloadchildnodes ()


{


//Get the XML data island object that loads the child node definition data


var xml = document.getElementById (' Skytreeviewcontroltempxml ');


if (XML = = null)


    {


return;


    }


if (xml.readystate!= ' complete ')


{//This time the XML data island is working, canceling the current operation


return;


    }


//Get the Tree List node object currently being processed


var rootnode = document.getElementById (Skytreeviewcontroldyanmicrootnodeid + ' _text ');


if (RootNode = null)


return;


var html = ';


var errorflag = false;





//Get the XML data island object containing the XSLT code


var xsl = document.getElementById (' skytreeviewcontrolxslt ');


if (xsl = = null)


    {


Error message set if XSLT document is not found


HTML = ' missing XSLT data ';


Errorflag = true;


    }


else if (XML. XMLDocument.parseError.errorCode!= 0)


    {


//Joga XML document errors that define child nodes set error messages


html = ' ERROR: ' + XML. XMLDocument.parseError.reason


+ ' [' + XML. XMLDocument.parseError.url + '] ';


Errorflag = true;


    }


Else


    {


if (XML. Xmldocument.documentelement = = null)


        {


html = ' root node not found ';


Errorflag = true;


        }


Else


        {


//Saves the number of HTML tags for the current node to an XML document.


XML. XMLDocument.documentElement.setAttribute (


' Rootid ',


Skytreeviewcontroldyanmicrootnodeid);





//Performs an XSLT transformation, generating an HTML string to display the child list


HTML = XML. Xmldocument.transformnode (XSL. XmlDocument);


        }


    }


//Delete the word "Loading " of the current node


var lbl = document.getElementById (Skytreeviewcontroldyanmicrootnodeid + ' _loading ');


if (lbl!= null)


    {


if (errorflag)


        {


lbl.innerhtml = ' <br/> ' + html;


return;


        }


//output dynamically generated HTML code to an HTML page


lbl.insertadjacenthtml (' afterend ', HTML);


Lbl.parentNode.removeChild (LBL);


    }


Else


    {


Output dynamically generated HTML code to an HTML page


rootnode.insertadjacenthtml (' afterend ', HTML);


    }





//Get the node's expansion point picture object


var myexpend = document.getElementById (Skytreeviewcontroldyanmicrootnodeid + ' _expend ');


//Get node icon Picture Object


var Myicon = document.getElementById (Skytreeviewcontroldyanmicrootnodeid + ' _icon ');


//Get the text object of the node


var myText = document.getElementById (Skytreeviewcontroldyanmicrootnodeid + ' _text ');


//Get child node table


var myTable = document.getElementById (Skytreeviewcontroldyanmicrootnodeid + ' _table ');





if (myexpend!= null


&& myicon!= null


&& myText!= null


&& myTable!= null)


    {


Change the control icon for the current node from the shrinking state to the expanded state


var srcback = myicon.src;


myicon.src = Myicon.getattribute (' Srcback ');


myicon.setattribute (' Srcback ', srcback);


        


srcback = myexpend.src;


myexpend.src = Myexpend.getattribute (' Srcback ');


myexpend.setattribute (' Srcback ', srcback);





//mytable.scrollintoview (FALSE);


    }





Skytreeviewcontroldyanmicrootnodeid = null;





}//function skytreeviewcontroldynamicloadchildnodes ()





//--------This paragraph JavaScript definition ends--------------------------





</script>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.