Issue with RadAjaxManger

2 posts, 0 answers
  1. Harin Yadav
    Harin Yadav avatar
    31 posts
    Member since:
    Jan 2011

    Posted 30 Nov 2012 Link to this post

    HI,

    we have a RadGrid which Has 1 RadCombo with LoadonDemand and 2buttons to "ADD" and "DEL" Rows
    to avoid Postback we are using RadAjaxManager on RadGrid

    Issue here is while clicking Add button for first 5 times we are able to ADD records.
    after that if we click ADD button  it is not firing one more thing we observed id before clicking ADD button if we open the RadComboBox it is throwing error like "The Target <ID> for the Callback could not be found or did not implement IcallBackeventHandler"

    same thing is happening when we use ASP UpdatePanel

    if we Remove the RadAjaxManager or UpdatePanel  every thing is working Fine.

    Please Help! Quick reply will be highly appreciated

    Please find the Code below for more reference

    <telerik:RadAjaxManager ID="RadAjaxManager1"  runat="server">
                <AjaxSettings>
                     <telerik:AjaxSetting AjaxControlID="RadGrid_BrokerMgmt">
                         <UpdatedControls>  
                             <telerik:AjaxUpdatedControl ControlID="RadGrid_BrokerMgmt"></telerik:AjaxUpdatedControl>                          
                             <telerik:AjaxUpdatedControl ControlID="btnAddrw"></telerik:AjaxUpdatedControl>
                              <telerik:AjaxUpdatedControl ControlID="btnDelrw"></telerik:AjaxUpdatedControl>
                         </UpdatedControls>
                     </telerik:AjaxSetting>
                 </AjaxSettings>
             </telerik:RadAjaxManager>
             <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="5">             
               </telerik:RadAjaxLoadingPanel>
                          <table width="100%" style="border-width: 1px">
                     <tr>
                         <td style="border: 0px">
                             <telerik:RadGrid ID="RadGrid_BrokerMgmt" AllowPaging="false" AutoGenerateColumns="false"
                                 AllowSorting="false" runat="server" Width="100%" CssClass="RadGridCustomClass"
                                 OnItemDataBound="RadGrid_BrokerMgmt_ItemDataBound" BorderWidth="1px" BorderColor="Gray">
                                 <itemstyle cssclass="rwStyle_Brkmgnt" font-size="9px" />
                                 <mastertableview>
                                     <Columns>
                                         <telerik:GridTemplateColumn UniqueName="Broker_Name" DataField="Broker_Name" ItemStyle-Width="600px"
                                             ItemStyle-Wrap="false">
                                             <ItemTemplate>
                                               
                                                 <telerik:RadComboBox ID="ddlBrokers" runat="server" Width="150px" Font-Names="Arial"
                                                     Style="vertical-align: middle;" Skin="Outlook" CssClass="RadCombo" Font-Size="8pt"
                                                     HighlightTemplatedItems="True" MarkFirstMatch="true" AllowCustomText="true" EnableLoadOnDemand="true"
                                                     OnItemsRequested="ddlBroker_OnItemsRequested" OnClientDropDownOpening="OnClientDropDownOpening"
                                                     DropDownWidth="300px" MaxHeight="150px" />
                                                    
                                                 <asp:label id="lblBrokers" runat="server" font-bold="true" visible="false" font-names="Arial"
                                                     font-size="10px" />
                                                 <asp:button id="btnAddrw" runat="server" text="+" causesvalidation="false" style="vertical-align: middle"
                                                     commandargument='<%#Container.ItemIndex%>' oncommand="ADD_Command" />
                                                 <asp:button id="btnDelrw" runat="server" text="-" style="vertical-align: middle"
                                                     onclientclick="javascript :if(!deleteConfirmations()){return false;};" usesubmitbehavior="false"
                                                     commandargument='<%#Container.ItemIndex%>' oncommand="DEL_Command" />
                                                 
                                             </ItemTemplate>
                                         </telerik:GridTemplateColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NoOfOffices" DataField="NoOfOffices">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewSub" DataField="NewSub">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewSub_Count" DataField="NewSub_Count"
                                             ItemStyle-Width="120px">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewSub_Ratio" DataField="NewSub_Ratio"
                                             ItemStyle-Width="120px">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewQuote" DataField="NewQuote">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewQuote_Count" DataField="NewQuote_Count"
                                             ItemStyle-Width="120px">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewQuote_Ratio" DataField="NewQuote_Ratio"
                                             ItemStyle-Width="120px">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewBound" DataField="NewBound">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewBound_Count" DataField="NewBound_Count"
                                             ItemStyle-Width="120px">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewBound_Ratio" DataField="NewBound_Ratio"
                                             ItemStyle-Width="120px">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewForecast" DataField="NewForecast"
                                             ItemStyle-Width="100px">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewForecast_PR" DataField="NewForecast_PR"
                                             ItemStyle-Width="120px">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewForecast_Count"
                                             DataField="NewForecast_Count" ItemStyle-Width="120px">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="NewForecast_Ratio"
                                             DataField="NewForecast_Ratio" ItemStyle-Width="120px">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="RenBound" DataField="RenBound">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="Retention" DataField="Retention">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn UniqueName="TotalBoundForecast" DataField="TotalBoundForecast">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridNumericColumn ItemStyle-Wrap="false" UniqueName="VsPrior" DataField="VsPrior">
                                         </telerik:GridNumericColumn>
                                         <telerik:GridTemplateColumn UniqueName="Broker_Category" DataField="Broker_Category"
                                             Visible="false">
                                             <ItemTemplate>
                                                 <asp:label id="lblBroker_Category" runat="server" text='<%# Bind("Broker_Category") %>'>
                                                 </asp:label>
                                             </ItemTemplate>
                                         </telerik:GridTemplateColumn>
                                     </Columns>
                                 </mastertableview>
                             </telerik:RadGrid>
                         </td>
                     </tr>
                 </table>
    protected void ADD_Command(object sender, CommandEventArgs e)
       {
           try
           {
               //savebroker();
               int number, index = 0;
               DataTable Dt = (DataTable)Session["dt"];
               DataRow dr = Dt.NewRow();
               if (Int32.TryParse(e.CommandArgument.ToString(), out number))
               {
                   index = number + 1;
                  //GridItem item = RadGrid_BrokerMgmt.MasterTableView.GetItems(GridItemType.SelectedItem) as GridItem;
                  // Dt.Rows[number][1] = ((RadComboBox)item.FindControl("ddlBrokers")).SelectedValue;
               }
               foreach (GridDataItem item in RadGrid_BrokerMgmt.Items)
               {
                   if (number == item.ItemIndex &&  !string.IsNullOrEmpty(((RadComboBox)item.FindControl("ddlBrokers")).SelectedValue))
                   {
                       Dt.Rows[number][1] = ((RadComboBox)item.FindControl("ddlBrokers")).SelectedValue;
                   }
               }
               if (index > 0)
               {
                   for (int i = 0; i < Dt.Columns.Count; i++)
                   {
                       if (i == 0)
                           dr[0] = Dt.Rows[index - 1][0];
                       else if (i == 1)
                           dr[1] = " Select ";
                       else if (i == 2)
                           dr[2] = "0";
                       else
                           dr[i] = "";
                   }
               }
               //RadGrid_BrokerMgmt.MasterTableView.Columns.Clear();
               Dt.Rows.InsertAt(dr, index);
               RadGrid_BrokerMgmt.DataSource = Dt;
               RadGrid_BrokerMgmt.DataBind();
               Session["dt"] = Dt;
               RadGrid_BrokerMgmt.Items[0].Visible = false;
               //for (int i = 0; i < RadGrid_BrokerMgmt.Items.Count; i++)
               //{
               //    RadComboBox ddlBrokers = RadGrid_BrokerMgmt.Items[i].FindControl("ddlBrokers") as RadComboBox;
               //    ddlBrokers.DataSource = BindBroker();
               //    ddlBrokers.DataTextField = "Broker_Name";
               //    ddlBrokers.DataValueField = "Broker_Name";
               //    ddlBrokers.DataBind();
                   
               //}
           }
           catch (Exception ex)
           {
               throw new ApplicationException(ex.Message);
           }
       }


     

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 05 Dec 2012 Link to this post

    Hi Harin,

    Please note that it is not supported scenario to render UpdatePanels into the RadGrid content. By adding RadGrid control to update itself in the RadAjaxManager settings this will automatically force all control into the RadGrid to perform ajax request instead of postbacks. Therefore I would suggest you to just keep the setting in which the RadGrid control updates itself and remove the buttons form the RadAjaxManager settings.
    Give this a try and let me know how it goes.

    Greetings,
    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