SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru
    Join Date
    Dec 2008
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Message: 'childNodes.length' is null or not an object

    Message: 'childNodes.length' is null or not an object


    i have a function
    function GridAllCheck(Grid_Name)
    {
    var G_View = document.getElementById(Grid_Name).id;

    alert(G_View);//- here i am getting the gridview id

    for(var child1 = 0; child1 <= G_View.childNodes.length-1;child1++)
    {
    var G_Child1 = G_View.childNodes(child1);
    for(var child2 = 0; child2 <= G_Child1.childNodes.length-1;child2++)
    {

    }
    }
    }
    }

    i have multiple grids

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,198
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    An ID doesn't have any child nodes. It looks like you don't want G_View to be an ID, but to be an element, so remove the .id from the end. (I don't know if that's valid anyway.)

  3. #3
    SitePoint Guru
    Join Date
    Dec 2008
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok
    how do i solve the issue id i dont get the id & only get the element as ]
    var G_View = document.getElementById(Grid_Name);
    i have multiple grids(GridView) in a page
    i need a function such tht depending on the grid focused first i need to get its id
    like gridview1 .....
    for each grid i need to get childnodes

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,198
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    I recommend you post a full example of what you are trying to do. Here's a starting template:

    Code:
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    	
    <style>
    
    your CSS here
    
    </style>
    	
    </head>
    <body>
    
    your HTML here
    
    </body>
    
    <script>
    
    your JS here
    
    </script
    </html>

  5. #5
    SitePoint Guru
    Join Date
    Dec 2008
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here is the function thts used
    function SelectAll_G(G_Name)
    {
    var G_View = document.getElementById(G_Name);
    if(GdView == null)
    {
    return false;
    }
    switch(G_View.id)
    {

    case document.getElementById('<%=Grid_details1.ClientID %>').id:
    {
    alert(document.getElementById('<%=Grid_details1.ClientID %>').id);
    for(var child1 = 0; child1 <= G_View.childNodes.length-1;child1++)
    {
    var G_Child1 = GdView.childNodes(child1);
    for(var child2 = 0; child2 <= G_Child1.childNodes.length-1;child2++)
    {
    // code for enabling / disabling controls
    }
    }
    }
    }
    }

    i hve this for only one grid currently
    trying for multiple grids



    function SelectAll_G(G_Name) // tried this
    {
    var G_View = document.getElementById(G_Name);
    alert( document.getElementById(G_Name).id);
    if(GdView == null)
    {
    return false;
    }

    for(var child1 = 0; child1 <= G_View.childNodes.length-1;child1++)
    {
    var G_Child1 = GdView.childNodes(child1);
    for(var child2 = 0; child2 <= G_Child1.childNodes.length-1;child2++)
    {
    // code for enabling / disabling controls
    }
    }
    }
    }
    }

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,198
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Why not post some HTML, too, so people can see this in action—as described above.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •