checked property not working in treeview checkboxes

谁都会走 提交于 2019-12-25 04:48:55

问题


I have a treeview, I want to check all the children when I clicked the parent node from javascript. I have followed this link from stackoverflow. This process is currect. I have tested it with alert message also.

The ID which is showing in the alert message is exactly right ID of the child. And the method is been setting the status also. Code is reaching here childChkBoxes[i].checked = check;
function CheckUncheckChildren(childContainer, check) {
    var childChkBoxes = childContainer.getElementsByTagName("input");
    var childChkBoxCount = childChkBoxes.length;
    for (var i = 0; i < childChkBoxCount; i++) {
        alert("Childer lenght = "+childChkBoxes.length +"     childern ID  "+ childChkBoxes[i].id + "        Parent checked state =" + check);          
        childChkBoxes[i].checked = check;
    }
}

even the check box of child is not been checking in UI. What might be the problem. This code is working for every one. Why not working here, I am displaying the treeview in a modelpopupextender control. Is anything wrong with my browser, I am using firefox. Is anything wrong with my treeview design. her it is

 <asp:TreeView ID="tvFolderSelect" runat="server" RootNodeStyle-ForeColor="Black"
    CssClass="foldertree" LeafNodeStyle-ForeColor="Black" LeafNodeStyle-Font-Bold="false"
    ParentNodeStyle-ForeColor="Black" Width="100%" Style="margin: 3px 0 0 -16px;"
    OnTreeNodePopulate="tvFolderSelect_TreeNodePopulate" onclick="OnTreeClick(event);"
    ShowCheckBoxes="All" >
  <LeafNodeStyle Font-Bold="False" ForeColor="Black" CssClass="foldertreeleafnode"
        ImageUrl="~/images/img_dms/sm_fldr.png"  />
    <ParentNodeStyle Font-Italic="True" ImageUrl="~/images/img_dms/sm_fldr.png" Font-Underline="True"
        CssClass="foldertreeparentnode"/>
    <NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="0px"
        NodeSpacing="0px" VerticalPadding="0px" />
    <RootNodeStyle ForeColor="Black" CssClass="foldertreerootnode" />
    <SelectedNodeStyle Font-Underline="False" HorizontalPadding="0px" VerticalPadding="0px" />
</asp:TreeView>

I tried this code in normal aspx page(not in modelpopupextender). And it is working well

来源:https://stackoverflow.com/questions/21985699/checked-property-not-working-in-treeview-checkboxes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!