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

how to access radio button used in Telerik Tree as <NodeTemplate>

2 Answers 61 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Shakeel Rehman
Top achievements
Rank 1
Shakeel Rehman asked on 29 Jun 2010, 07:19 AM

Hi All,

I have used telerik tree view control in my code to select users as info and to field.

<telerik:RadTreeView ID="tvToDirectorate" runat="server" CheckChildNodes="True" OnNodeClick="tvToDirectorate_NodeClick"

                    OnDataBinding="tvToDirectorate_DataBinding" OnNodeDataBound="tvToDirectorate_NodeDataBound1"

                    DataFieldParentID="lParentID" DataTextField="sDisplayName" DataValueField="lValueID"

                    DataFieldID="lValueID" OnNodeExpand="tvToDirectorate_NodeExpand" >

<NodeTemplate>

<table cellpadding="0" cellspacing="0" width="100%" align="right">

<tr>

<td style="width: 50%">

      <asp:CheckBox ID="rdTo" name='<%# Container.Value %>' runat="server" GroupName="toinfo" Visible="true" />

      </td>

      <td style="width: 50%">

      <asp:CheckBox ID="rdInfo" name='<%# Container.Value %>' runat="server" GroupName="toinfo" Visible="true"/>

       </td>

       </tr>

</table>

</NodeTemplate>

</telerik:RadTreeView>

The checkboxes are dynamically creating name with different IDs. Now I want following.

1.       I want to access name in JavaScript so that I would be able to select one checkbox as “Info” or “To”. Currently at a time both can be selected but that’s not good.

2.       Secondly if I am using radio button that is a good choice. But I want to deselect when double click radio button. And I cannot be able to access the radio button on run time.

On main window I am using telerik grid control where using

<EditFormSettings EditFormType="WebUserControl" PopUpSettings-Modal="true" PopUpSettings-Width="800px" UserControlName="~/UserControls/ucMailRecipient.ascx">

<PopUpSettings Modal="True" Width="800px" />

</EditFormSettings>

When click on “Add Recipients” popup window with “Modal=True” open where we selects the users.

We cannot use “document.getElementById("rdTo").checked;” since its dynamically creating.

And may be name should like “$ctl_TreeView_”  etc may be.

Please if anybody helps to tackle this problem. Many thanks for your help.

Thanks

2 Answers, 1 is accepted

Sort by
0
Shakeel Rehman
Top achievements
Rank 1
answered on 30 Jun 2010, 05:35 AM
Many thanks for providing me very useful information. Thanks alot
0
Princy
Top achievements
Rank 2
answered on 30 Jun 2010, 08:01 AM
Hello Shakeel,

Here I found a forum which discussed similar scenario of using RadioButton for accomplishing the requirement : how to access radio button used in Telerik Tree as NodeTemplate

You can follow same approach of iterating through the nodes and attaching the onclick event to checkbox, if you want to use checkbox instead.

Thanks,
Princy.
Tags
TreeView
Asked by
Shakeel Rehman
Top achievements
Rank 1
Answers by
Shakeel Rehman
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or