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

Enable MultipleSelect using Client Script

5 Answers 80 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
mohmedsadiq modan
Top achievements
Rank 1
mohmedsadiq modan asked on 12 Jun 2010, 12:05 PM
Hello,


I have tree and i need to set MultipleSelect property when user click on Checkbox.

 <Telerik:RadTreeView ID="RadTreeView2" runat="server" EnableDragAndDrop="True" EnableDragAndDropBetweenNodes="true"
                            BorderWidth="1px" Height="600px" >
                            <ContextMenus>
                            </ContextMenus>
</Telerik:RadTreeView>

 <asp:CheckBox ID="cbMerge" runat="server" Text="Click me" />

I do that using client call back but it is not working properly can you help me how to enable/disable MultipleSelect property using client script.


Thanks in Advance

Sadiq modan

5 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 14 Jun 2010, 07:41 AM
Hello Sadiq,

Use the client side method set_multipleSelect() of RadTreeView client object, in order to set the MultiSelect property from client script.

APSX:
 
<asp:CheckBox ID="cbMerge" runat="server" Text="Click me" onclick="multiSelect(this);" /> 
<telerik:RadTreeView ID="RadTreeView4" runat="server" CheckBoxes="True">  
    <Nodes>  
      . . .  


Client Script:
 
<script language="javascript" type="text/javascript"
    function multiSelect(chk) { 
        var tree = $find("<%= RadTreeView4.ClientID %>"); 
        if (chk.checked) { 
            tree.set_multipleSelect(true); 
        } 
        else { 
            tree.set_multipleSelect(false); 
        } 
    } 
</script> 


-Shinu.
0
mohmedsadiq modan
Top achievements
Rank 1
answered on 14 Jun 2010, 10:37 AM
Hello Shinu,

Thanks for your quick response,

yes that work fine at client side but when I select node more than one from tree and then postback page i get selected node count is one and treeview property MultipleSelect = false. after that  I also add two lines .trackChanges() and commitChanges() then check it again but also I got same result.I have to get all selected node count with its value, can you please suggest me how can this work in backend.

Thanks in advance,
sadiq modan
0
Nikolay Tsenkov
Telerik team
answered on 15 Jun 2010, 09:18 AM
Hello mohmedsadiq modan,

I think the best way to go about this is to set the property MultipleSelect of the TreeView on the server.
You can achieve this by trapping the CheckedChanged event server-side and there just set the property with line similar to the following:
RadTreeView1.MultipleSelect = true;

The markup of this CheckBox would be:
<asp:CheckBox runat="server" ID="checkBox1" AutoPostBack="true" Text="MultipleSelect"
            OnCheckedChanged="checkBox1_CheckedChanged" />

Hope this is going to solve your problem!


Kind regards,
Nikolay Tsenkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
mohmedsadiq modan
Top achievements
Rank 1
answered on 15 Jun 2010, 12:52 PM
Hello Nikolay Tsenkov ,

thanks for your quick response but in page i have a 200 to 300 nodes loaded if i go to the server side event then execution take more time, due to this I need to implement at client side.

I also apply ClientChanges property at server side but it is not working still.

Please help me out for this problem.


thanks in advance
0
Nikolay Tsenkov
Telerik team
answered on 18 Jun 2010, 11:37 AM
Hello mohmedsadiq modan,

Well, if it was only for data that needs to be persisted, then you could easily use trackChanges and commitChanges, but the properties are not persisted through this method.

Here is a workaround:
- What you can do now is to set it initially in multi-selection mode (in the code behind or even in the markup) and disable it on the onClientLoad of the tree client-side. That way on the server this property will be always set to true and anyway you will get the right number of selected nodes, because if on the client is set to false your users won't be able to select more than 1 node.

Hope that this solves your problem!


Regards,
Nikolay Tsenkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeView
Asked by
mohmedsadiq modan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
mohmedsadiq modan
Top achievements
Rank 1
Nikolay Tsenkov
Telerik team
Share this question
or