JeffDrummond
asked on
Check all checkboxes in a treeview
In my ASP.Net 2.0 C# application, I have a page with two treeviews.
Each node of the treeviews has a checkbox.
I need a method of checking/unchecking all of the checkboxes
on the individual treeviews. Can I do this in Javascript?
Thanks.
Each node of the treeviews has a checkbox.
I need a method of checking/unchecking all of the checkboxes
on the individual treeviews. Can I do this in Javascript?
Thanks.
Go to browser and copy the complette page html source with both treeviews here as text.
ASKER
The page is quite large. This is the portion inculding the two treeviews, Regions and Categories. Thanks!
<table width="350">
<tr>
<td valign="top">
Regions: </td><td>Cat egories:</ td>
</tr>
<tr>
<td align="left" valign="top">
<a href="#ctl00_Body_RegionsT reeview_Sk ipLink"><i mg alt="Skip Navigation Links." src="/WebResource.axd?d=-Z mMyGfj3hop Va_HZUpeJg 2&t=63 2883495870 637959" width="0" height="0" style="border-width:0px;" /></a><div id="ctl00_Body_RegionsTree view">
<table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX2 SfMWA3mIjc L_y6D_rPDZ Q1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_RegionsTr eeviewn0Ch eckBox" id="ctl00_Body_RegionsTree viewn0Chec kBox" checked="checked" title="Asia" /><a class="ctl00_Body_RegionsT reeview_0" href="javascript:__doPostB ack('ctl00 $Body$Regi onsTreevie w','sAsia' )" onclick="TreeView_SelectNo de(ctl00_B ody_Region sTreeview_ Data, this,'ctl00_Body_RegionsTr eeviewt0') ;" id="ctl00_Body_RegionsTree viewt0">As ia</a></td >
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX- EvRUG_TP5U CG1aTnSOUW Y1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_RegionsTr eeviewn1Ch eckBox" id="ctl00_Body_RegionsTree viewn1Chec kBox" title="Africa" /><a class="ctl00_Body_RegionsT reeview_0" href="javascript:__doPostB ack('ctl00 $Body$Regi onsTreevie w','sAfric a')" onclick="TreeView_SelectNo de(ctl00_B ody_Region sTreeview_ Data, this,'ctl00_Body_RegionsTr eeviewt1') ;" id="ctl00_Body_RegionsTree viewt1">Af rica</a></ td>
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX- EvRUG_TP5U CG1aTnSOUW Y1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_RegionsTr eeviewn2Ch eckBox" id="ctl00_Body_RegionsTree viewn2Chec kBox" checked="checked" title="North America" /><a class="ctl00_Body_RegionsT reeview_0" href="javascript:__doPostB ack('ctl00 $Body$Regi onsTreevie w','sNorth America')" onclick="TreeView_SelectNo de(ctl00_B ody_Region sTreeview_ Data, this,'ctl00_Body_RegionsTr eeviewt2') ;" id="ctl00_Body_RegionsTree viewt2">No rth America</a></td>
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX- EvRUG_TP5U CG1aTnSOUW Y1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_RegionsTr eeviewn3Ch eckBox" id="ctl00_Body_RegionsTree viewn3Chec kBox" title="South America" /><a class="ctl00_Body_RegionsT reeview_0" href="javascript:__doPostB ack('ctl00 $Body$Regi onsTreevie w','sSouth America')" onclick="TreeView_SelectNo de(ctl00_B ody_Region sTreeview_ Data, this,'ctl00_Body_RegionsTr eeviewt3') ;" id="ctl00_Body_RegionsTree viewt3">So uth America</a></td>
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX- EvRUG_TP5U CG1aTnSOUW Y1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_RegionsTr eeviewn4Ch eckBox" id="ctl00_Body_RegionsTree viewn4Chec kBox" title="Europe" /><a class="ctl00_Body_RegionsT reeview_0" href="javascript:__doPostB ack('ctl00 $Body$Regi onsTreevie w','sEurop e')" onclick="TreeView_SelectNo de(ctl00_B ody_Region sTreeview_ Data, this,'ctl00_Body_RegionsTr eeviewt4') ;" id="ctl00_Body_RegionsTree viewt4">Eu rope</a></ td>
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX4 iascjIf74m JB0-PvYVJW k1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_RegionsTr eeviewn5Ch eckBox" id="ctl00_Body_RegionsTree viewn5Chec kBox" title="Australia" /><a class="ctl00_Body_RegionsT reeview_0" href="javascript:__doPostB ack('ctl00 $Body$Regi onsTreevie w','sAustr alia')" onclick="TreeView_SelectNo de(ctl00_B ody_Region sTreeview_ Data, this,'ctl00_Body_RegionsTr eeviewt5') ;" id="ctl00_Body_RegionsTree viewt5">Au stralia</a ></td>
</tr>
</table>
</div><a id="ctl00_Body_RegionsTree view_SkipL ink"></a>
</td>
<td align="left" valign="top">
<a href="#ctl00_Body_Categori esTreeView _SkipLink" ><img alt="Skip Navigation Links." src="/WebResource.axd?d=-Z mMyGfj3hop Va_HZUpeJg 2&t=63 2883495870 637959" width="0" height="0" style="border-width:0px;" /></a><div id="ctl00_Body_CategoriesT reeView">
<table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX2 SfMWA3mIjc L_y6D_rPDZ Q1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_Categorie sTreeViewn 0CheckBox" id="ctl00_Body_CategoriesT reeViewn0C heckBox" title="Prayer" /><a class="ctl00_Body_Categori esTreeView _0" href="javascript:__doPostB ack('ctl00 $Body$Cate goriesTree View','s1' )" onclick="TreeView_SelectNo de(ctl00_B ody_Catego riesTreeVi ew_Data, this,'ctl00_Body_Categorie sTreeViewt 0');" id="ctl00_Body_CategoriesT reeViewt0" >Prayer</a ></td>
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><a id="ctl00_Body_CategoriesT reeViewn1" href="javascript:TreeView_ ToggleNode (ctl00_Bod y_Categori esTreeView _Data,1,ct l00_Body_C ategoriesT reeViewn1, 't',ctl00_ Body_Categ oriesTreeV iewn1Nodes )"><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzXw Jx33l_NPW5 7t40m7ht-9 kLit0N6NM4 XuHy2GC36l In0&t= 6328834958 70637959" alt="Collapse Volunteer" style="border-width:0;" /></a></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_Categorie sTreeViewn 1CheckBox" id="ctl00_Body_CategoriesT reeViewn1C heckBox" checked="checked" title="Volunteer" /><a class="ctl00_Body_Categori esTreeView _0" href="javascript:__doPostB ack('ctl00 $Body$Cate goriesTree View','s2' )" onclick="TreeView_SelectNo de(ctl00_B ody_Catego riesTreeVi ew_Data, this,'ctl00_Body_Categorie sTreeViewt 1');" id="ctl00_Body_CategoriesT reeViewt1" >Volunteer </a></td>
</tr>
</table><div id="ctl00_Body_CategoriesT reeViewn1N odes" style="display:block;">
<table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><div style="width:20px;height:1 px"><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzXw q8Ng0NpL3M LUVHpxHvn5 E1&t=6 3288349587 0637959" alt="" /></div></td><td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX- EvRUG_TP5U CG1aTnSOUW Y1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_Categorie sTreeViewn 2CheckBox" id="ctl00_Body_CategoriesT reeViewn2C heckBox" title="Volunteer SubCat 1" /><a class="ctl00_Body_Categori esTreeView _0" href="javascript:__doPostB ack('ctl00 $Body$Cate goriesTree View','s2\ \6')" onclick="TreeView_SelectNo de(ctl00_B ody_Catego riesTreeVi ew_Data, this,'ctl00_Body_Categorie sTreeViewt 2');" id="ctl00_Body_CategoriesT reeViewt2" >Volunteer SubCat 1</a></td>
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><div style="width:20px;height:1 px"><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzXw q8Ng0NpL3M LUVHpxHvn5 E1&t=6 3288349587 0637959" alt="" /></div></td><td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX4 iascjIf74m JB0-PvYVJW k1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_Categorie sTreeViewn 3CheckBox" id="ctl00_Body_CategoriesT reeViewn3C heckBox" title="Volunteer SubCat 2" /><a class="ctl00_Body_Categori esTreeView _0" href="javascript:__doPostB ack('ctl00 $Body$Cate goriesTree View','s2\ \7')" onclick="TreeView_SelectNo de(ctl00_B ody_Catego riesTreeVi ew_Data, this,'ctl00_Body_Categorie sTreeViewt 3');" id="ctl00_Body_CategoriesT reeViewt3" >Volunteer SubCat 2</a></td>
</tr>
</table>
</div><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX- EvRUG_TP5U CG1aTnSOUW Y1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_Categorie sTreeViewn 4CheckBox" id="ctl00_Body_CategoriesT reeViewn4C heckBox" title="Advocating" /><a class="ctl00_Body_Categori esTreeView _0" href="javascript:__doPostB ack('ctl00 $Body$Cate goriesTree View','s3' )" onclick="TreeView_SelectNo de(ctl00_B ody_Catego riesTreeVi ew_Data, this,'ctl00_Body_Categorie sTreeViewt 4');" id="ctl00_Body_CategoriesT reeViewt4" >Advocatin g</a></td>
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX- EvRUG_TP5U CG1aTnSOUW Y1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_Categorie sTreeViewn 5CheckBox" id="ctl00_Body_CategoriesT reeViewn5C heckBox" title="Giving" /><a class="ctl00_Body_Categori esTreeView _0" href="javascript:__doPostB ack('ctl00 $Body$Cate goriesTree View','s4' )" onclick="TreeView_SelectNo de(ctl00_B ody_Catego riesTreeVi ew_Data, this,'ctl00_Body_Categorie sTreeViewt 5');" id="ctl00_Body_CategoriesT reeViewt5" >Giving</a ></td>
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8 jlEUJvtIzQ gBusQxIzX4 iascjIf74m JB0-PvYVJW k1&t=6 3288349587 0637959" alt="" /></td><td style="white-space:nowrap; "><input type="checkbox" name="ctl00_Body_Categorie sTreeViewn 6CheckBox" id="ctl00_Body_CategoriesT reeViewn6C heckBox" title="Serving" /><a class="ctl00_Body_Categori esTreeView _0" href="javascript:__doPostB ack('ctl00 $Body$Cate goriesTree View','s5' )" onclick="TreeView_SelectNo de(ctl00_B ody_Catego riesTreeVi ew_Data, this,'ctl00_Body_Categorie sTreeViewt 6');" id="ctl00_Body_CategoriesT reeViewt6" >Serving</ a></td>
</tr>
</table>
<table width="350">
<tr>
<td valign="top">
Regions: </td><td>Cat
</tr>
<tr>
<td align="left" valign="top">
<a href="#ctl00_Body_RegionsT
<table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8
</tr>
</table>
</div><a id="ctl00_Body_RegionsTree
</td>
<td align="left" valign="top">
<a href="#ctl00_Body_Categori
<table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><a id="ctl00_Body_CategoriesT
</tr>
</table><div id="ctl00_Body_CategoriesT
<table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><div style="width:20px;height:1
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><div style="width:20px;height:1
</tr>
</table>
</div><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8
</tr>
</table><table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><img src="/WebResource.axd?d=f8
</tr>
</table>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Zvonko! Works perfectly!
You are welcome.