Javascrip with Treeview control in ASP.net 2.0...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vebuda
    New Member
    • Jun 2007
    • 8

    #1

    Javascrip with Treeview control in ASP.net 2.0...

    Hi all,

    I am using a treeview control in asp.net. I am populating the nodes and child nodes of the control from a sql database. I have checkboxes for all nodes and child nodes. What I want to do is check all the child nodes on clicking of a parent node on the client side. How do I achieve this? Also I am bit confused on how javascript and asp.net work together?

    sorry for posting in this forum i did not know that .net is the right forum for this query.
  • pronerd
    Recognized Expert Contributor
    • Nov 2006
    • 392

    #2
    Originally posted by vebuda
    What I want to do is check all the child nodes on clicking of a parent node on the client side.
    Code:
    <html>
        <body>
            <input type="checkbox" id="parrentBox" onChange="setChildren('true');" />
            <p>
                <input type="checkbox" id="childBox1" />
                <input type="checkbox" id="childBox2" />
            </p>
        </body>
        <script>
            function setChildren(status) {
                document.getElementById('childBox1').checked = status;
                document.getElementById('childBox2').checked = status;
            }
        </script>
    </html>


    Originally posted by vebuda
    Also I am bit confused on how javascript and asp.net work together?
    ASP.net is a server side language that handles tasks on the server. Things like connecting to the database, and rendering the HTML pages. JavaScript is a client side language that runs in the browser. It only runs after the page is created and loaded in the browser.



    Originally posted by vebuda
    sorry for posting in this forum i did not know that .net is the right forum for this query.
    Since your question relates to JavaScript this is the correct forum.

    Comment

    Working...