Sunil Lama
Sunil Lama

Reputation: 4539

Telerik filter function

I have a portion of JavaScript that runs on document ready. However, when i use the filtering of telerik, after successful filter the function that was on document ready is not being registered.

 $(document).ready(function () {
         // Match all link elements with href attributes within the content div
         $('#image1').qtip({
             content: {
                 text: true
             },
             style: {
                 classes: 'qtip-rounded qtip-shadow',
             },
             position: {
                 my: 'top center',  // Position my top left...
                 at: 'bottom center', // at the bottom right of...
                 target: $('.selector') // my target
             }
             //position: {
             //    target: 'mouse',
             //}
         });
});

Is there any function of telerik that gets invoked when we click any of the dropdown value of the filtering provided by telerik. If so, i could register the javascript function from the codebehind. Or, if i could be acknowledged with any other methods.

Upvotes: 0

Views: 58

Answers (1)

Leo
Leo

Reputation: 14850

If you're using Telerik Ajax Controls for ASP.NET then it is normal behaviour that after filtering, a postback (or async postback) is issued. Ajax async post backs cannot be intercepted by jQuery's ready function because of the way Microsoft Ajax works.

$(function(){
     //this will only be triggered on the response to the first request
});

You should be using Microsoft Ajax syntax instead in order to intercept Ajax responses...

var mngInstance = Sys.WebForms.PageRequestManager.getInstance();

mngInstance.add_endRequest(endReq);
mngInstance.add_pageLoaded(pageLoaded);

function endReq(sender, args){
    //executes after an async request ends
}

function pageLoaded(sender, args){
    //executes after the whole page is loaded after an async postback
}

Be aware that you will need to a RadScriptManager to the page (or master page). For more infor check the MSDN documentation

Upvotes: 2

Related Questions