check all check box how in TreeView

i have a TreeView inside it i have check box in all nod i want when i select the man nod all chiled check how can i do that


thanks alot for any help
http://www.feckra.com/blog/
0
wael_e
3/10/2008 1:19:33 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

3 Replies
855 Views

Similar Articles

[PageSpeed] 39
Get it on Google Play
Get it on Apple App Store

post your  tree binding code.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him forever.
0
ramireddyindia
3/10/2008 1:33:51 PM


wael_e :

i have a TreeView inside it i have check box in all nod i want when i select the man nod all chiled check how can i do that

see link below

http://geekswithblogs.net/ranganh/archive/2006/03/25/73300.aspx 


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
3/10/2008 1:40:43 PM

Hi... I am using the following code.. for this task.

 

function client_OnTreeNodeChecked()
{
var obj = window.event.srcElement;
var treeNodeFound = false;
var checkedState;
if (obj.tagName == "INPUT" && obj.type == "checkbox") {
var treeNode = obj;
checkedState = treeNode.checked;
do
{
obj = obj.parentElement;
} while (obj.tagName != "TABLE")
var parentTreeLevel = obj.rows[0].cells.length;
var parentTreeNode = obj.rows[0].cells[0];
var tables = obj.parentElement.getElementsByTagName("TABLE");
if(obj.tagName == "TABLE")
{
   if (treeNode.checked) //if any child is checked check parent
   {
     //head1 gets the parent node of the checked node
      var head1 = obj.parentElement.previousSibling;
      if(head1!=null)
      {
        if(head1.tagName == "TABLE")
        {
            //checks for the input tag which consists of checkbox
            var matchElement1 = head1.getElementsByTagName("INPUT");
            //matchElement1[0] gives us the checkbox and it is checked
            if(matchElement1.length>0)
                matchElement1[0].checked = true;
        }
      }
      else {
                head1 = obj.parentElement.previousSibling;
            }
            if(head1!=null)
            {
                if(head1.tagName == "TABLE")
                {
                    //head2 gets the parent node of the checked node
                    var head2 = obj.parentElement.parentElement.previousSibling;
                    if(head2!=null)
                    {
                        if(head2.tagName == "TABLE")
                        {
                            //checks for the input tag which consists of checkbox
                            var matchElement2 = head2.getElementsByTagName("INPUT");
                            if(matchElement2.length>0)
                                 matchElement2[0].checked = true;
                        }
                    }
                }
            }
            else {
                    head2 = obj.parentElement.previousSibling;
                 }
            if(head2!=null)
            {
                if(head2.tagName == "TABLE")
                {
                    //head3 gets the parent node of the checked node
                    var head3 = obj.parentElement.parentElement.parentElement.previousSibling;
                    if(head3!=null)
                    {
                        if(head3.tagName == "TABLE")
                        {
                            //checks for the input tag which consists of checkbox
                            var matchElement3 = head3.getElementsByTagName("INPUT");
                            if(matchElement3.length>0)
                                matchElement3[0].checked = true;
                        }
                     }
                }
            }
            else {
                    head3 = obj.parentElement.previousSibling;
                 }
            if(head3!=null)
            {
                if(head3.tagName == "TABLE")
                {
                    //head4 gets the parent node of the checked node
                    var head4 = obj.parentElement.parentElement.parentElement.parentElement.previousSibling;
                    if(head4 != null)
                    {
                        if(head4.tagName == "TABLE")
                        {
                            //checks for the input tag which consists of checkbox
                            var matchElement4 = head4.getElementsByTagName("INPUT");
                            if(matchElement4.length>0)
                                matchElement4[0].checked = true;
                        }
                    }
                }
            }

}//end if - checked
if (!treeNode.checked)//if all child are unchecked then uncheck parent
   {
    var chk1 = false;
    var head1 = obj.parentElement.previousSibling;
    var pTreeLevel1 = obj.rows[0].cells.length;
    if(head1!=null)
    {
    if(head1.tagName == "TABLE")
    {
        var tbls = obj.parentElement.getElementsByTagName("TABLE");
        var tblsCount = tbls.length;
        for (i=0; i < tblsCount; i++)
        {
            var childTreeLevel = tbls[i].rows[0].cells.length;
            if (childTreeLevel = pTreeLevel1)
            {
                var chld = tbls[i].getElementsByTagName("INPUT");
                if(chld.length>0)
                {
                    if (chld[0].checked == true)
                    {
                        chk1 = true;
                        break;
                    }
                }
            }
        }
        var nd = head1.getElementsByTagName("INPUT");
        if(nd.length>0){
        nd[0].checked = chk1;}
    }
    }
    else
    {
        head1 = obj.parentElement.previousSibling;
    }
    var chk2 = false;
    if(head1!=null)
    {
    if(head1.tagName == "TABLE")
    {
        var head2 = obj.parentElement.parentElement.previousSibling;
        if(head2!=null)
        {
        if(head2.tagName == "TABLE")
        {
            var tbls = head1.parentElement.getElementsByTagName("TABLE");
            var pTreeLevel2 = head1.rows[0].cells.length;
            var tblsCount = tbls.length;
            for (i=0; i < tblsCount; i++)
            {
                var childTreeLevel = tbls[i].rows[0].cells.length;
                if (childTreeLevel = pTreeLevel2)
                {
                  var chld = tbls[i].getElementsByTagName("INPUT");
                  if(chld.length>0)
                  {
                      if (chld[0].checked == true)
                      {
                        chk2 = true;
                        break;
                      }
                  }
                }
            }
            var nd = head2.getElementsByTagName("INPUT");
            if(nd.length>0){
            nd[0].checked = (chk2 && chk1);}
        }
        }
    }
    }
    else
    {
        head2 = obj.parentElement.previousSibling;
    }
    var chk3 = false;
    if(head2!=null)
    {
    if(head2.tagName == "TABLE")
    {
        var head3 = obj.parentElement.parentElement.parentElement.previousSibling;
        if(head3!=null)
        {
        if(head3.tagName == "TABLE")
        {
   
            var tbls = head2.parentElement.getElementsByTagName("TABLE");
            var pTreeLevel3 = head2.rows[0].cells.length;
            var tblsCount = tbls.length;
            for (i=0; i < tblsCount; i++)
            {
                var childTreeLevel = tbls[i].rows[0].cells.length;
                if (childTreeLevel = pTreeLevel3)
                {
                    var chld = tbls[i].getElementsByTagName("INPUT");
                    if(chld.length>0)
                    {
                        if (chld[0].checked == true)
                        {
                            chk3 = true;
                            break;
                        }
                    }
                }
            }  
            var nd = head3.getElementsByTagName("INPUT");
            if(nd.length>0){
            nd[0].checked = (chk3 && chk2 && chk1);}
        }
        }
    }
    }
    else
     {
        head3 = obj.parentElement.previousSibling;
     }
    var chk4 = false;
    if(head3!=null)
    {
        if(head3.tagName == "TABLE")
        {
            var head4 = obj.parentElement.parentElement.parentElement.parentElement.previousSibling;
            if(head4!=null)
            {
                if(head4.tagName == "TABLE")
                {
                    var tbls = head3.parentElement.getElementsByTagName("TABLE");
                    var pTreeLevel4 = head3.rows[0].cells.length;
                    var tblsCount = tbls.length;
                    for (i=0; i < tblsCount; i++)
                    {
                        var childTreeLevel = tbls[i].rows[0].cells.length;
                        if (childTreeLevel = pTreeLevel4)
                        {
                            var chld = tbls[i].getElementsByTagName("INPUT");
                            if(chld.length>0)
                            {
                                if (chld[0].checked == true)
                                {
                                    chk4 = true;
                                    break;
                                }
                            }
                        }
                    }
                    var nd = head4.getElementsByTagName("INPUT");
                    if(nd.length>0){
                    nd[0].checked = (chk4 && chk3 && chk2 && chk1);}
                }
            }
        }
    }
}//end if - unchecked
}
var numTables = tables.length
if (numTables >= 1)
{
for (i=0; i < numTables; i++)
{
if (tables[i] == obj)
{
treeNodeFound = true;
i++;
if (i == numTables)
{
return;
}
}
if (treeNodeFound == true)
{
var childTreeLevel = tables[i].rows[0].cells.length;
if (childTreeLevel > parentTreeLevel)
{
var cell = tables[i].rows[0].cells[childTreeLevel - 1];
var inputs = cell.getElementsByTagName("INPUT");
inputs[0].checked = checkedState;
}
else
{
return;
}
}
}
}
}
}

 

try it.... 



Please, 'Mark as Answer' if this post has helped you!

- Bihag Thaker

http://bihagthaker.blogspot.com/

0
bihagsasp
3/10/2008 2:46:24 PM
Reply:

Similar Artilces:

Java script popup dialog box when a check box control is checked. How to do with a check box?
 I have a checkbox named cbxGetInfo. If someone checks the checkbox, I want to a popup dialog box confirming the action that will be done because of the checkbox being checked. A few months ago, I used a Java Script popup dialog box for a confirmation on an action being done. Now I need to figure out how to do this for when a check box has been checked. Can someone tell me what I am doing wrong. Here is the code I place in my C# code.    cbxGetInfo.Attributes.Add("onchecked", "javascript:if(confirm('Are you sure you want to delete this record?...

Check All Check Box While Check Header CheckBox
 hello...I have two grid on same page...both grid contains header checkbox and item checkbox i want that if use check header checkbox then all item check box checked,i have javascript for this functinality but problem is that when i click on header check box of first grid then checkbox of second grid also checked that i dnt want i want to perform this operation on one grid at one time.i have attache my script also...plz help me....thanks<script type="text/javascript">        function SelectAll(ID)      &nbs...

how to check if a check box created in runtime checked or not?
I have a webform that have mutiple collectios of check boxes created on run time ( database driven) what is the best way to loop between them and get which ones has been checked by a user and save the results back to the database below a portion of my code. i am adding the checkbox to cell table which added to a row, then to a table, finlally the table added to a place holderwhile (drProfileList.Read()) {HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell tc = new HtmlTableCell();CheckBox chkbox = new CheckBox(); chkbox.ID = drProfileList["RoleID"].ToString();chkbox.T...

How to check how many check boxes are checked in the gridview
I am trying to make a javascript client fucntion to restrict no more then two rows could be selectedI have following in the itemtemplate of the gridview [although it is telerik control but same technique should be applied] <radG:GridTemplateColumn UniqueName="chkCheck">                    <HeaderStyle  HorizontalAlign="Right" />                    <HeaderTempla...

Checking Check Boxes
I've got a page that edits user permissions that I'm porting from PHP. When the page loads, I need the site to load a checkbox list with the name of the various items and the IDs as the value. This is easy. However, I also need it to check off the selected items. This information is stored in a seperate database table. Using a JOIN I can write a query that will return the page id, the page name, and the permissions of the user fairly easily. However, I don't know what attribute to set in order for appropriate boxes to be checked when the page loads. I'm posting this in the PHP m...

Check Box changes other check boxes
Hi, I have a question concerning changing a check box without doing a post back on the page. I would like to do something like this: Public Sub checkAll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles checkAll.CheckedChanged If checkAll.Checked = False Then    checkVisio.Checked = True    checkPPT.Checked = True    checkRawArt.Checked = True    checkFlatArt.Checked = True Else    checkVisio.Checked = False    checkPPT.Checked = False    checkRawArt.Checked = F...

How to check for the existing user in database and using custom validator how to check check box is checked or not?
Hi Friends, For Registration page i want to check if that user already exist in database or not? and i also have to check if user have check the checkbox for i agree then only he will be able to complete registration. here i am sending my design. and all validation i have done all validation except these two.<html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PRIZE MLS</title><link href="css/style.c...

Check out/check in
Hello How can i use the process check out/check in in PowerBuilder 8.0.3 ? We work in network. The Source Control is PB Native. I don't understand what is the parameters of Source Control ? Thank you Have you looked the PB8 User's guide? Chapter 3 talks about source control. -- Evita Chapa Senior Systems Analyst II Command Technologies Inc. <Herv� Bareth> wrote in message news:3f69ba0a.592b.846930886@sybase.com... > Hello > > How can i use the process check out/check in in PowerBuilder > 8.0.3 ? We work in network. The Source Control is PB Na...

Check-in/Check-out
I'm having some difficulty with powerbuilder's check-in/check-out operation. When I check an object back in, the .pbl the object is being moved from is destroyed. Has anyone else experienced this and is there a fix? Cheers, Tom Thomas F. (Tom) Massey wrote: > > I'm having some difficulty with powerbuilder's check-in/check-out > operation. When I check an object back in, the .pbl the object is > being moved from is destroyed. > > Has anyone else experienced this and is there a fix? > > Cheers, > > Tom The prob...

Check In Check Out
I have some source code that I need to modify and it was sent to me in a Registered status. Therfore, when I open any object it says " 'object name' is registered but not checked out and therefore can not be overwritten. Open anyway?" Then when I try to check it out, I get "PBNative checkout not allowed for registered objects." How can I get around this? When I look under the "Source" menu, all the items concerning registered are grayed out. TIA Option1:Copy the object(Only) to someother pbl and try . Option2:If You have any SCC Expo...

Check in
Hi all. I am migrating from PB 7.0 to PB 10.5, After migrating my first application i am trying to work on my first window but i'am not able to find out the way to CHECK it OUT. Wher do i can find "check out/check in" functions ?? TIA Mario Parietti What source control are you using? Have you configured it? Right click on your Workspace and check the source control tab to see if you've got it set up. "Mario Parietti" <mparietti@intercad.ch> wrote in message news:451283e0$1@forums-1-dub... > Hi all. > I am migrating from PB...

Check In/Check out
I am using PowerBuilder 9. The undo check out is right next to the check in. This is a big problem! I so easy to select Undo check out and lose all of your changes. I lost 8 hours of work yesterday because of it. I know I should be more careful. However, there should be a "Are you sure" some where also. PLEASE FIX!!!!!!!!!!!!! -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ This isn't the tech support line, it's an end-user forum. If you want to report a bug, use CaseXpress and either open a case or report a bug ...

Check out/check in
Hello How can i use the process check out/check in in PowerBuilder 8.0.3 ? We work in network. The Source Control is PB Native. I don't understand what is the parameters of Source Control ? Thank you Better to ask this in the source control group. Lots of posts on PBNative -- Evita Chapa Senior Systems Analyst II Command Technologies Inc. <Herv� Bareth> wrote in message news:3f69678e.7b3a.846930886@sybase.com... > Hello > > How can i use the process check out/check in in PowerBuilder > 8.0.3 ? We work in network. The Source Control is PB Native. ...

Checked=Checked
 I am dynamically writing out checkboxes on a page.  I have 2 link buttons on the page that sets a boolean variable to True or False. This boolen is set in Page_PreInit and is used to Select or Deselect all the Checkboxes as they are written out. A Select ALL, Deselect ALL type of thing. At least that is the plan. As the page is being written out I do this for each checkbox and then add it to a table cell control that it added to a table row and on. tc is the table cell.  Dim chkItem As CheckBox = New CheckBox chkItem.ID = "chkRecommend" + drMember("ID")...

Web resources about - check all check box how in TreeView - asp.net.web-forms

Live-Beta TreeView Demo: Frameless Layout with Highlighting TreeView Demo: Frameless Layout with Highlighting ...
Welcome to our beta site for CBC Live mp3 streams! This is a form of online broadcast we are exploring right now, both from a technical best-practices ...

Visual Basic for Applications - Wikipedia, the free encyclopedia
Visual Basic for Applications ( VBA ) is an implementation of Microsoft 's event-driven programming language Visual Basic 6 and its associated ...

From the Saint
It's full steam ahead for events in the Saint today; although some have been postponed, others are getting bigger and better.

HOME - St. Catharines
St. Catharines is a city that offers many ammenities and opportunities to its residents. It is a place known for its friendliness, charm and ...

CrossFont Help
CrossFont Help

Examples - AlloyUI
AlloyUI is a framework built on top of YUI3 that provides a simple API for building high scalable applications.

allworldsoft.com — all software.
Xara X1 1.1 DL Xara X is an advanced graphic illustration package for Windows, that offers unrivaled redraw speed and a user interface which ...

CrossFont Help
CrossFont Help

Evolution of the Windows Interface
... a 3D button, comboboxes. Windows 95 introduced a slew of new 3D controls, such as rich text edit, toolbars/statusbar, progressbar, treeview/listview, ...

Silverlight - Blackboard
Silverlight is a development platform for creating rich media applications and business applications for the Web, desktop, and mobile devices.Microsoft ...

Resources last updated: 1/13/2016 5:13:57 PM