트리구조는 제대로 나오거든요...근데 마지막 마지막 자식노드를 클릭했을때 item(1)에 있는 주소로 페이지가 이동해야 하는데...아무 변화가 없어요...
그럼 아래 코드에서 loadXML()이 계속 false로 넘오와서 그런건가요?
강의를 계속보고 코드보고 어디가 잘못돼나 찾아보는데 왜 그런지 모르겠어요..
혹시 이부분이 아니고 클릭을 했을때 이벤트가 작동을 안해서 그런건가요?
이벤트에 대해선 아무리 공부하고 들어도 헤깔려서 ^^;
<script event="NodeClicked()" for="_Control1">
var xmlText = _Control1.SelectedNodeText;
var xmlDoc = new ActiveXObject( "Microsoft.XMLDOM" );
if ( xmlDoc.loadXML( xmlText ) == true )
{
window.open(xmlDoc.selectSingleNode( "L" ).childNodes.item( 1 ).text,"");
}
</script>
public void LoadXML( string text )
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml( text );
XmlNodeList nodeList = xmlDoc.SelectNodes( "tree/L" );
SetTreeData( nodeList, null );
}
private bool SetTreeData( XmlNodeList nodeList, TreeNode parentNode )
{
if ( nodeList == null )
{
return false;
}
int count = nodeList.Count;
for ( int i = 0; i < count; i ++ )
{
XmlNode node = nodeList.Item( i );
TreeNode aNode = new TreeNode();
aNode.Text = node.ChildNodes.Item(0).InnerText;
aNode.Tag = node;
if ( parentNode == null )
{
_treeView.Nodes.Add( aNode );
}
else
{
parentNode.Nodes.Add( aNode );
}
SetTreeData( node.SelectNodes( "./L" ), aNode );
XmlNode attrNode = node.Attributes.GetNamedItem( "expand" );
if ( attrNode != null && attrNode.Value == "T" )
{
aNode.Expand();
}
}
return true;
}
[최초 등록일: ]
[최종 수정일: 3/24/2006]