HOW TO: ??? ???? ?????? ?? ????? ????? ?? .aspx ?????? ???????? Visual Basic .NET

?????? ????????? ?????? ?????????
???? ???????: 328923 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ???? ????? ??? ????? ????? ???? .aspx ????? ???? ???? ??? ??????? HTML ???????? ???? ??? ??????? ??? ???? ??? ?????? ??????? ??? ????? ????? ???? ??????. ?????? ??? ??????? ?????? ?????? ???? ???? TreeView ????? ??? ?????? ??????.

????? AutoPostBack

  • ????. ????? ???? AutoPostBack True ???? ????? ?? ??? ???? ?????? ??? ???? ??? ?????? ??????? ??????? ???? ?? ???? ?? ???? ??? ????? ?????.

    ??? ???? ??????? ????? AutoPostBack ??? True ??? TreeView ?????? ???? ??? ????? ????? ???????? ??? ???????: onExpand; onCollapse; onCheck; ? onSelectedIndexChange.
  • ???. ?????? AutoPostBack ??? False ??? ????? ?????? ???????? ??? ??? ????.

????? ????????? ????????

??? ??? ?????? ??????? ???? onSelectedIndexChange ? ???? ??????? ???????.
  1. ????? "????? ???" ?? ?? ???? ???? ???? TreeView ?? ???? .aspx.
  2. ?? ???? .aspx ????? ????? AutoPostBack ???? ???? TreeView ??? False.
  3. ?? ??????? ?????TreeView ? ???? ??? ???? elipsis (...) ?????? ?? ?? ?????? ??? ????? ? ??????? ??? ?????? ??? TreeView.
  4. ?????? ??? onload ???? HTML ?? ?? ???????? ?????? initTree. ??? ????? ??? ?????? ???? ?????? ?? ????? Page_Load ???? .aspx.

    ?? ????? ??? HTML ???? .aspx ????? ????? ????? onload ??? ??????? body ??? ???:
    <body onload="initTree()">
    					
  5. ?? ?????? ???????? ???????? ??????? ?? ??? ?????? Page_Load ??? ?????? Page_Load ?? ??? ??????? ??? ??? aspx. strTreeName
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim strTreeName As String = "TreeView1"
        Dim strRef As String = Page.GetPostBackEventReference(TreeView1)
        Dim strScript As String = "<script language=""JavaScript""> " & vbCrLf & _
            "<!-- " & vbCrLf & _
            "	function initTree() { " & vbCrLf & _
            "		" & strTreeName & ".onSelectedIndexChange = function() { " & vbCrLf & _
            "			if (event.oldTreeNodeIndex != event.newTreeNodeIndex) " & vbCrLf & _
            "				this.queueEvent('onselectedindexchange', event.oldTreeNodeIndex & ',' & event.newTreeNodeIndex); " & vbCrLf & _
            "			window.setTimeout('" & strRef.Replace("'", "\'") & "', 0, 'JavaScript'); " & vbCrLf & _
            "		} " & vbCrLf & _
            "	} " & vbCrLf & _
            "// --> " & vbCrLf & _
            "</script>"
    
        Page.RegisterClientScriptBlock("InitTree", strScript)
    End Sub
    					

??? ????????? ????????

????? ??????? ????????? ????????

?? ????? ????????? ???????? ???????? ?? ??? ??????? ???????? ??????? ???????:
  • ?? ????? ??? ???? .aspx ?????? AutoPostBack ???? ???? TreeView ?? ??? True.
  • ???? .aspx ?? ???? ?? ?????? Internet Explorer ?? ?? ???? ?????? ??? ??? .html.
  • ?? ????? AutoPostBack ???? ???? TreeView ??? False ??? ?? ?? ??? ?????? ??? ???? ?? ????????.
  • ?????? ??????? ? ???????? ?????????? ??????? ????? ??? ???????? ?? ??? ???????.

?????? ?? ????????? ??? ????????? ????????

  • ???? ????????? ???????? ?? ?????? Page_Load ?? ??? ??????? ???????? ???????? ??????? ?? ????????:
    <script language="JavaScript">
    <!-- 
        function initTree() { 
            TreeView1.onSelectedIndexChange = function() { 
                if (event.oldTreeNodeIndex != event.newTreeNodeIndex) 
                    this.queueEvent('onselectedindexchange', event.oldTreeNodeIndex & ',' & event.newTreeNodeIndex); 
    
                window.setTimeout('__doPostBack(\'TreeView1\',\'\')', 0, 'JavaScript'); 
            } 
        } 
    // -->
    </script>
    						
    ?????? initTree ??? ??????? ??? ????? ???? HTML ?? ????????. ?????? ?????? initTree ????? onSelectedIndexChangeTreeView1 ???? ????? onSelectedIndexChange ????? ??? ????? ?????? ??????? ?????? ??? ?? ??? ????? ??? ??????.
  • ????? ????? ?? ???? onSelectedIndexChange
    if (event.oldTreeNodeIndex != event.newTreeNodeIndex) 
        this.queueEvent('onselectedindexchange', event.oldTreeNodeIndex + ',' + event.newTreeNodeIndex);
    						
    ???? ?????? ?? ??????? ?????? ?????? ??? ?? ???? ?? ??? .html ????????.
  • ???? ??????? AutoPostBack TreeView ??? True ???????? ???????? ??????? ?? HTML:
    window.setTimeout('__doPostBack(\'TreeView1\',\'\')', 0, 'JavaScript');
    						
    ??? ?? ????? ???? ????? ????? (?? ??? ??????? __doPostBack) ?? ????????, ????? ?????? ??? ?????? ???????? ????????? ???????? ???????:
    string strRef = Page.GetPostBackEventReference(TreeView1);
    					
    ??????? ???? ????? ????? ????? ?? ?? Page_Load ?????? ????? ????? ????? ??? ??????.

?????

?????? ??? ??????? ??????? ???? ??? ????? ???????? ??????? ?????? ?? "????? ??????? ?? Microsoft:
305140INFO: ASP.NET ???????

319441HOW TO: ???? ???? ????? ??? ??? ???? ???? WebBrowser TreeView ???????? Visual Basic .NET
???? WebControls ?????? ??????
http://msdn.microsoft.com/en-us/library/ms528669(VS.85).aspx

???????

???? ???????: 328923 - ????? ??? ??????: 25/???? ??????/1424 - ??????: 3.4
????? ???
  • Microsoft ASP.NET 1.0
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft ASP.NET 1.1
  • Microsoft Visual Basic .NET 2003 Standard Edition
????? ??????: 
kbmt kbhowtomaster kbservercontrols KB328923 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????328923

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com