Cancel OnClientSelectedIndexChanging with Webservice callback function

6 posts, 0 answers
  1. Karl
    Karl avatar
    172 posts
    Member since:
    Jun 2009

    Posted 18 Apr 2011 Link to this post

    Hi,

    I have a RadCombo with the following event : OnClientSelectedIndexChanging which contains a call to a web service which returns a value. Depending on the value I may need to cancel the change. I have a callback function attached to the webservice.

     

    How would I going about cancelling the change if I needed to?

     

    Thanks

  2. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 19 Apr 2011 Link to this post

    Hi Karl,

    You can try cancelling the OnClientSelectedIndexChanging event in this way:
    function OnClientSelectedIndexChangingHandler(sender, eventArgs)
    {
        var value = "web_service_Result";
        if (value !="web_service_Result" )
            eventArgs.set_cancel(false)
        else
            eventArgs.set_cancel(true);
    }

    More details about OnClientSelectedIndexChanging event you can find at this help article.

    Best wishes,
    Kalina
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Karl
    Karl avatar
    172 posts
    Member since:
    Jun 2009

    Posted 23 May 2011 Link to this post

    Hi,

    I'm using a Callback function to get the return value from my webservice like so:

     

    function OnClientSelectedIndexChanging(sender, eventArgs)
    {
        WebServiceRoot.CheckInterval(<%=ID %>, item.get_text(), CallbackInternalCheck);
        if(window.intervalcheck)
        {
            alert('|1:' + window.intervalcheck);
            eventArgs.set_cancel(false)
        }
        else
        {
            alert('|2:' + window.intervalcheck);
            eventArgs.set_cancel(true);
        } 
    }
    var intervalcheck;
    function CallbackInternalCheck(result) {
       intervalcheck = result;
    }
    When I do the above intervalcheck is always underfined. Any other ideas?

    Thanks
  4. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 26 May 2011 Link to this post

    Hi Karl,

    Could you verify, if the callback function is executed, because if the "intervalcheck" variable is undefined then you are not assigning any value to it.

    On how to call a callback function, please refer to the following threads here and here.

    Regards,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. Karl
    Karl avatar
    172 posts
    Member since:
    Jun 2009

    Posted 27 May 2011 Link to this post

    Hi,
    I've put and alert(result) and it brings back a value. When I assigned it to internalcheck and try and access it within the OnClientSelectedIndexChanging it becomes undefined. I can get the value from internalcheck else where but but not in OnClientSelectedIndexChanging.

    Thanks
  6. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 01 Jun 2011 Link to this post

    Hello Karl,

    In order to investigate the cause of this issue, please open a support ticket and provide us with runnable version of your project in order to test it locally.

    Greetings,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top