Adding Ajax to RadGrid breaks RadGrid1.SelectedItems

2 posts, 0 answers
  1. Thomas
    Thomas  avatar
    2 posts
    Member since:
    Oct 2010

    Posted 28 Nov 2012 Link to this post

    Hi,

    I have a grid with a checkbox column I am able to select multiple rows then click an itemcommand button that will run code for each selected row. The code below works great and I can process each selected row. The problem is that there is no visual indicator that the process is running and the users end up clicking the button two or three times. I am attempting to add the grid into the ajax manager (see below) when I do that, I do get the loading panel. The problem is that grdAvailableItems.SelectedItems is empty there are no selected items.
    Any Ideas?  

    Thanks,
    Tom Usselman
    protected void GrdAvailableItems_ItemCommand(object sender, GridCommandEventArgs e)
           {
               if (e.CommandName == "AddToQuote")
               {
                   try
                   {
                       bool renumber = false;
                       hdnAddAdditionalItems.Value = "Yes";
                       foreach (GridDataItem item in grdAvailableItems.SelectedItems)
                       {
                           int multiplier = Convert.ToInt16(item["multiplier"].Text);
                           Single curprice = Convert.ToSingle(item["curprice"].Text);

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
    DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="grdAvailableItems">
    <UpdatedControls>
    <telerik:AjaxUpdatedControl ControlID="grdQuoteItems" />
    <telerik:AjaxUpdatedControl ControlID="grdAvailableItems"
    LoadingPanelID="RadAjaxLoadingPanel1" />
    </UpdatedControls>
    </telerik:AjaxSetting>
    </AjaxSettings>
    </telerik:RadAjaxManager>
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 03 Dec 2012 Link to this post

    Hello Thomas,

    I suppose that the issue you are facing appears in case the user clicks several times to select different items before the previous request has finished.
    By design ASP.NET AJAX Framework cancels the ongoing ajax request if you try to initiate another one prior to receiving the response from the first one. By setting the RequestQueueSize property to a value greater than zero, you are enabling the queueing mechanism of RadAjax, that will allow you to complete the ongoing request and then initiate the pending requests in the control queue.
    Give this a try and let me know if it works.

    Kind regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top