Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make an ASP.NET TreeView not visible using JavaScript?

I'd like to click a node in my ASP.NET TreeView and make visible=false;. How do I do that in JavaScript?

like image 984
vasagam Avatar asked Nov 04 '22 22:11

vasagam


1 Answers

You need to set a NagivateUrl equal to a Javascript function in the TreeView node to hide the button.

<asp:TreeView ID="TreeView1" runat="server" >
        <Nodes>
            <asp:TreeNode Text="" Value="" NavigateUrl="javascript:HideButton();"></asp:TreeNode>
        </Nodes>
    </asp:TreeView>

 <script type="text/javascript" language="javascript">
    function HideButton() {
        document.getElementById('<%=Button1.ClientID %>').style.visibility = "hidden";
    }
</script>
like image 128
Muhammad Akhtar Avatar answered Nov 12 '22 12:11

Muhammad Akhtar