locked
how to access radio button/checkbox button used in Telerik Tree as <NodeTemplate> RRS feed

  • Question

  • User601844714 posted

    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

    Tuesday, June 29, 2010 2:23 AM

All replies

  • User1890873615 posted

    I'm not sure I fully understand the problem, but in general you can use this in ASP.NET to get the dynamically generated IDs that ASP.NET produces:

    <%= rdInfo.ClientID %>


    This will result in the correct HTML ID being output so that you can use code like "document.getElementById" (or even more handy, use jQuery and $() selectors).

    Tuesday, July 20, 2010 5:51 PM