This is a migrated thread and some comments may be shown as answers.

Checkboxes with IDs and labels

4 Answers 118 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Holly
Top achievements
Rank 1
Holly asked on 30 Jun 2009, 09:54 AM
Hi,
I'm trying to get my website to the point where it is WCAG 2.0 AA compliant.
To achieve this, checkboxes need to have associated labels. If I could allocate an ID to each checkbox within the treeview I could then force the the label via the name parameter when creating the node but I cannot see how to allocate that ID.
Ie.
From this
<input type="checkbox" checked="checked" />
<span class="TreeNode" title="Details of Internal Organisational Strucutre">Internal Organisational Structure 3</span>
To
<input type="checkbox" checked="checked" id = "chkone"/>
<span class="TreeNode" title="Details of Internal Organisational Strucutre">
<label for = "chkone">Internal Organisational Structure 3</label>
</span>

Is there a better/any way of doing this?
Thanks

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 30 Jun 2009, 01:57 PM
Hi Holly,

You can achieve that by using the NodeTemplate of RadTreeView. I have attached a sample page demonstrating the required code. Make sure your checkbox has its CssClass property set to "rtChk" so RadTreeView recognizes it as its own checkbox. Also the CheckBoxes property should be set to false to avoid rendering of the built-in checkbox.

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Holly
Top achievements
Rank 1
answered on 30 Jun 2009, 03:52 PM
Thanks Albert,
That's nearly perfect :c)
Is there anyway to do this from the server side? I have code-behind that automatically populates the tree view, where some of the nodes should have check boxes but most not.
If need be, I can probably manage to do this via placeholders, but would rather not if there is a less roundabout route.
Thanks again
0
Atanas Korchev
Telerik team
answered on 01 Jul 2009, 07:53 AM
Hi Holly,

You can just instantiate the required controls and add them to the node's Controlls collection. Just make sure the properties are set right.

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Philip Jones
Top achievements
Rank 1
answered on 14 Jul 2009, 04:51 PM

Hi there

 

It seems to be the same problem I am having right now. I have the latest RadTreeView component on my page and I am using certain client events e.g. "OnClientNodeChecked" in order to check the children and parent nodes according to the requirements

As part of the WCAG compliance, I have to associate labels with the checkboxes as well. I tried the suggested solution of having checkboxs and labels inside the NodeTemplate and setting the Cssclass to "rtChk".

It associated the checkbox with the label successfully; However the client event of OnClientNodeChecked stopped working. Is there any other way to achieve this i.e. associating the built-in checkboxes to labels.

Thanks in advance.

Regrads

Tags
TreeView
Asked by
Holly
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Holly
Top achievements
Rank 1
Philip Jones
Top achievements
Rank 1
Share this question
or