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

OnClientSelectedIndexChanged problem..

3 Answers 160 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Johan Kartiwa
Top achievements
Rank 2
Johan Kartiwa asked on 17 Oct 2008, 09:06 AM
Hi,

I have a form that has a number of RadComboBox'es, and selectively add a javascript client event to some comboboxes.

To put it simple..:
C#:
{
    var cb = RadComboBox1;
    if (some_condition == true
        cb.OnClientSelectedIndexChanged = "OnClientSelectedIndexChanged"

ASPX:
<telerik:RadComboBox ID="RadComboBox1" runat="server" Width="200px" 
    MarkFirstMatch="true" HighlightTemplatedItems="true" 
    DataTextField="Text" DataValueField="ID" ItemRequestTimeout="500" 
    Skin="Vista"
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</telerik:RadComboBox> 


javascript:
function OnClientSelectedIndexChanged(item) 
    var combo = item.ComboBox; 
    alert(combo.GetText() + ' ' + combo.GetValue() + ' - ' + combo.ClientID); 
 


However when I do some selection change to the combobox in the browser, the item.ComboBox returns 'undefined'.

What else do I need to do?


3 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 17 Oct 2008, 09:43 AM
Hi Johan,

Please check this help topic which shows how to get the selected item in OnClientSelectedIndexChanged event handler.

Regards,
Yana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Johan Kartiwa
Top achievements
Rank 2
answered on 17 Oct 2008, 01:22 PM
Hi Yana,

Thank you for your quick reply.

I just wonderring, what is the difference with:
http://www.telerik.com/help/aspnet/combobox/comboclsidejava.html
(Here, OnClientSelectedIndexChanged takes 1 parameter only)


and why can't I use the Client-Side Object Model as shown in:
http://www.telerik.com/help/aspnet/combobox/comboclsideobject.html


0
Veselin Vasilev
Telerik team
answered on 17 Oct 2008, 01:27 PM
Hi Johan Kartiwa,

The URLs you pointed are for the "classic" RadComboBox. The new RadComboBox for ASP.NET AJAX has a different client-side API thus - a different online help location.

Greetings,
Veselin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Johan Kartiwa
Top achievements
Rank 2
Answers by
Yana
Telerik team
Johan Kartiwa
Top achievements
Rank 2
Veselin Vasilev
Telerik team
Share this question
or