OnClientSelectedIndexChanging event not fired in Javascript

3 posts, 0 answers
  1. Saad
    Saad avatar
    2 posts
    Member since:
    Apr 2015

    Posted 17 Apr 2015 Link to this post

    Hi I have a RadComboBox in my app where i intend to use OnClientIndexChanging event to cancel the changing of the values based on some specific conditions, however the event is not getting fired in client side JS code ​​

     

    <telerik:RadComboBox ID="cbStyleSize" style="width:100%" EmptyMessage="--Select Style Size--" runat="server" RenderMode="Native" DataTextField="Name" DataValueField="ID" OnClientSelectedIndexChanging="OnChanging_Style" OnClientSelectedIndexChanged="OnChanged_Style">
    </telerik:RadComboBox>

    As you can see i have both OnClientSelectedIndexChanged and OnClientSelectedIndexChanging events , however only OnClientSelectedIndexChanged event is getting fired in JS but not the Changing event.

    01.function OnChanged_Style(sender, eventArgs) {
    02.    var item = eventArgs.get_item();
    03.    var item_text = item.get_text();
    04.    var itemValue = item.get_value();
    05.     
    06.    var ret = ExtractComboValues(itemValue);
    07.     
    08.    if (ret) {
    09.        setData({
    10.            sID: ret.sID,   
    11.            Name: item_text,
    12.            fPrice: ret.price
    13.        });
    14.         
    16.    }
    17.}
    18. 
    19.function OnChanging_Style(sender, eventArgs) {
    20.    var item = eventArgs.get_item();
    21.    var item_text = item.get_text();
    22.    var itemValue = item.get_value();
    23.     
    24.    var ret = ExtractComboValues(itemValue);
    25.    var targetID = ret.sID;
    26.         
    27.    var errFunc  = function(e)  { e.set_cancel(true); }
    28.    var succFunc = function(e)  { e.set_cancel(false);}
    29.     
    30.    if (ret) {
    31.        VerifySelection(targetID, succFunc, eventArgs, errFunc, eventArgs); 
    32.    }
    33.}

     

    Just on a side note , the OnChanging_Style JS function , makes an AJAX call through VerifySelection function and based on the result of that function set_cancel(true) is being called. .Do you think its legal that an AJAX function whenever returns can revert back the ComboBox fired event ?

     

  2. Saad
    Saad avatar
    2 posts
    Member since:
    Apr 2015

    Posted 20 Apr 2015 in reply to Saad Link to this post

    anyone care to comment ?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 22 Apr 2015 Link to this post

    Hello Saad,

    When the RadComboBox is in Native render mode it is rendered as a simple html select element. In this case the OnClientSelectedIndexChanging client-side event is not supported, as there is no corresponding event to handle for this action.

    Regards,
    Nencho
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top