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

using jQuery --> server side callback to update a RadGrid

1 Answer 138 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 30 Jul 2011, 12:12 AM
Greetings,

I have a page with a radGrid and a button that allow my user to download a file, now if I use the RadAjax Manger to configure
the button to an AJAX style postback this will confict with the file download  -- if you do this you get Parse Error, as you
are messing w/ the server response :)

This page also has a grid that shows the data that is being downloaded with a status column that displays if 'exported' process
has been completed. i.e..(the user downloaded the file)  

Here's my goal, user clicks to the get the download, and aspx server side code sub. rgRequests_NeedDataSource is  invoked causing the RadGrid to be updated 

I am using client side jQuery.to update the text lables on the page with out issue,

but I do not understand how to invoke a server side code (asp.net).


// this is wired up to a ASP:BUTTON -- onClick event

function upDatePAMLabel(label,grid) {
             $("#" + label).html("There are no User IDs waiting to be exported");
  
          // AJAX Call back here to refresh the grid
          //  $("#" + grid).ajax("PortalAdminManager.aspx", "", "rgRequests_NeedDataSource","");
          
        /*   does nothing!
          $.ajax({
              type: "POST",
              url: "PortalAdminManager.aspx/rgRequests_NeedDataSource",
              data: "{}",
              contentType: "application/json; charset=utf-8",
              dataType: "json",
              success: function (msg) {
                  alert(msg)
              }
          });
          */
          
        //  brute force method - to refresh the grid
         // force a reload so that Request Status is updated in the grid
          $(document).ready(function () {
              setTimeout(function () { window.location.href = "./PortalAdminManager.aspx"; }, 1000);
            });
        
 }


So if anyone has done this, please a post a solution  or a suggestion!

Thanks,

Dave Gilden MCSD / Ft. Worth, Tx




1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 04 Aug 2011, 01:03 PM
Hi David,

If you bind the RadGrid with Advanced Data-binding (using NeedDataSource event) and the RadGrid is ajaxified you could try using the client side OnAjaxRequest function of the RadAjaxManager or RadAjaxPanel. Then into a server side RadAjaxManager1_AjaxRequest event handler you could call RadGrid.Rebind() method which will force the RadGrid to be rebound and the NeedDataSource event to be called.

Please give it try and let me know if it helps you.

Kind regards,
Radoslav
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
Ajax
Asked by
David
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or