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

How to disable selectedindex change event in radcombobox

3 Answers 281 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Esther Nirmala
Top achievements
Rank 1
Esther Nirmala asked on 26 Apr 2010, 02:25 PM
Hi,
I am have radcombobox with checkbox items. I have javascript functions on the item chekbox check event. But if i click on the item it is getting selected. Actually i don need that feature. I need to perform the same checkbox check event even when the item clicked. Pls suggest me the better way of doing it.

Thanks,
Nimmi

3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 26 Apr 2010, 05:06 PM
Hello Esther Nirmala,

The solution is to use ItemTemplates - CheckBox and Label as this:

<telerik:RadComboBox ID="RadComboBox1" runat="server">
            <ItemTemplate>
                <div onclick="StopPropagation(event)">
                    <asp:CheckBox runat="server" ID="chk1" Checked="true" onclick="onCheckBoxClick(this)" />
                    <asp:Label runat="server" ID="Label1" AssociatedControlID="chk1" Text='<%# DataBinder.Eval(Container,"Text") %>'/>
                </div>
            </ItemTemplate>
            <Items>
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" Value="RadComboBoxItem1" />
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" Value="RadComboBoxItem2" />
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" Value="RadComboBoxItem3" />
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem4" Value="RadComboBoxItem4" />
            </Items>
        </telerik:RadComboBox>

To prevent the ComboBox of closing when you click on one of the items use this:

<script type="text/javascript">
        function StopPropagation(e)
            {
                //cancel bubbling
                e.cancelBubble = true;
                if (e.stopPropagation)
                {
                    e.stopPropagation();
                }
            }
        </script>

You may find the full code in the attached .zip file.

Hope this helps.

Regards,
Veronica Milcheva
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
Esther Nirmala
Top achievements
Rank 1
answered on 27 Apr 2010, 11:49 AM
Hi,

    I tried that.. but even if i click the label its still displaying the text of label which is the data text property of rad combo item..
    How to overcome this problem.. am creating the rad combo and template dynamically from code behind.. please suggest..

Thanks
Nimmi
0
Veronica
Telerik team
answered on 30 Apr 2010, 11:14 AM
Hi Esther Nirmala,

Could you please provide your code so we can be able to help you?

Thank you!

Regards,
Veronica Milcheva
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
ComboBox
Asked by
Esther Nirmala
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Esther Nirmala
Top achievements
Rank 1
Share this question
or