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

Cancel OnClientSelectedIndexChanging with Webservice callback function

5 Answers 67 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 18 Apr 2011, 03:44 PM

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

5 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 19 Apr 2011, 05:47 PM
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.

0
Karl
Top achievements
Rank 1
answered on 23 May 2011, 05:04 PM
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
0
Dimitar Terziev
Telerik team
answered on 26 May 2011, 02:32 PM
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.

0
Karl
Top achievements
Rank 1
answered on 27 May 2011, 01:45 PM
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
0
Dimitar Terziev
Telerik team
answered on 01 Jun 2011, 04:32 PM
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.

Tags
ComboBox
Asked by
Karl
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Karl
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or