Issue with the combination of RadXmlHttpPanel and RadAjaxPanel

2 posts, 0 answers
  1. Anirban
    Anirban avatar
    2 posts
    Member since:
    Jul 2010

    Posted 06 Aug 2010 Link to this post

    I have got an issue with the combination of RadXmlHttpPanel and RadAjaxPanel. The scenario is described below-

    I have a page Product.aspx. There are left menus in a user control LeftMenu.ascx. In the main section of the page there are ten user controls which are used to Add or edit a product. This main user controls' visibility can be on/off by clicking the left menus and it is done in client side javascript. Now to make the performance optimized we decided to load the user control's data on demand. There are only two user controls which has required fields. So those control's data will be loaded on page load. But the other eight control's data will be loaded if the user decides to open that user control by clicking the left menu.
    To accomplish this I followed the demo given here The on demand user control's data controls are wrapped by RadXmlHttpPanels. The data is loaded by javascript-

    function leftMenuClicked(index) {

    function showPanelData(index) {
        var productId = getProductId();   
            var panel = getXmlHttpPanel(index);
            if (panel) {

    The getXmlHttpPanel() function just returns the RadXmlHttpPanel object using $find() function according to the index value.

    Now, there are few user controls which are used to add/edit detail data. There is a RadGrid in the control to show the existing records. Just below that there is a "Add More" button, by clicking which a form will be opened below the button to enter the data. The grid also has edit and delete buttons. The edit won't be inline, but the data will be opened in the same form used for adding. So, to ajaxify this, I have wrapped everything inside the control i.e. the grid and the form for add/edit in a RadAjaxPanel. Here is one of the User control's code-

    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="WebBlue" />
                    <telerik:RadAjaxPanel ID="radAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
                    <telerik:RadXmlHttpPanel ID="RadXmlHttpPanel1" runat="server" OnServiceRequest="XmlHttpPanel_ServiceRequest"
                    RenderMode="Block" LoadingPanelID="RadAjaxLoadingPanel1">
                        <asp:panel runat="server" CssClass="rc_fields" id="divProductMediaGrid" ClientIDMode="Static" style="min-height: 200px;">
                            <telerik:RadGrid AutoGenerateColumns="False" ID="RadGridProductMedia" runat="server" Skin="WebBlue" OnItemDataBound="RadGridProductMedia_ItemDataBound" OnItemCommand="RadGridProductMedia_ItemCommand" AllowPaging="true" PageSize="4"  EnableClientScriptEvaluation="true" >
                                <PagerStyle Mode="NumericPages" />
                                <MasterTableView TableLayout="Fixed">
                                        <telerik:GridTemplateColumn HeaderText="Type">
                                                <asp:Label ID="lblMediaType" runat="server" Text='<%# GetMediaTypeText(Convert.ToInt32( Eval("MediaType"))) %>'></asp:Label>
                                        <telerik:GridTemplateColumn HeaderText="Thumbnail" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                                                <asp:Image ID="imgThumbnail" runat="server" AlternateText="Thumbnail" ImageAlign="Middle" Height="50px" Width="70px" />
                                        <telerik:GridBoundColumn HeaderText="Caption" DataField="Caption" HeaderStyle-Width="180px"  />
                                        <telerik:GridBoundColumn HeaderText="Sort Order" DataField="SortOrder" HeaderStyle-Width="115px" />
                                        <telerik:GridCheckBoxColumn HeaderText="Is Primary" DataField="IsPrimary" HeaderStyle-Width="110px" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" />
                                        <telerik:GridCheckBoxColumn HeaderText="Is Active" DataField="IsActive" HeaderStyle-Width="120px" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" />
                                        <telerik:GridButtonColumn Text="Edit" UniqueName="EditMedia" CommandName="EditMedia" ButtonType="ImageButton" HeaderStyle-Width="60px" ItemStyle-HorizontalAlign="Center" ImageUrl="~/assets/images/Edit.gif"  />
                                        <telerik:GridButtonColumn Text="Delete" UniqueName="DeleteMedia" CommandName="DeleteMedia" ButtonType="ImageButton" HeaderStyle-Width="60px" ItemStyle-HorizontalAlign="Center"  ImageUrl="~/assets/images/Delete.gif"  ConfirmDialogType="RadWindow" ConfirmText="Are you sure you want to Delete this Media?" ConfirmTitle="Delete" />
                        <div style="float: right;">
                            <asp:LinkButton ID="lnkAddMoreMedia" CausesValidation="false" runat="server" CssClass="first" OnClick="lnkAddMoreMedia_Click" Text="<b><b>Add More Media</b></b>"></asp:LinkButton>
                        <asp:panel runat="server" CssClass="rc_fields" id="divProductMediaForm" ClientIDMode="Static" Visible="false" >                         
                                <label>Type </label>
                                <asp:DropDownList ID="drpMediaType" AutoPostBack="true" OnSelectedIndexChanged="drpMediaType_SelectedIndexChanged"  runat="server" ClientIDMode="Static" />
                                <label>Thumbnail </label>
                                <div style="float:right;width: 82%;">
                                    <telerik:RadAsyncUpload ID="uploadThumbnail"   runat="server" AllowedFileExtensions="jpg,jpeg,png,gif" Skin="WebBlue" TemporaryFolder="~/Upload/temp"  />                           
                                <label>Caption </label>
                                <asp:TextBox ID="txtCaption"  runat="server" MaxLength="150"  />                           
                                <label>Sort Order </label>
                                <telerik:RadNumericTextBox ID="txtSortOrder" Skin="WebBlue"  runat="server" MaxLength="2" NumberFormat-DecimalDigits="0" NumberFormat-AllowRounding="true"  />                           
                                <label>Is Primary </label>
                                <input type="checkbox" ID="chkIsPrimary" class="checkbox"  runat="server"   />                           
                                <label>Is Active </label>
                                <input type="checkbox" ID="chkIsActive" class="checkbox"  runat="server"   />                           
                            <div class="buttons">
                                <asp:LinkButton ID="lnkAdd" CausesValidation="false" runat="server" CssClass="first" OnClick="lnkAdd_Click" Text="<b><b>Save Media</b></b>"></asp:LinkButton>                             
                            <asp:HiddenField ID="hidProductMediaId" runat="server" ClientIDMode="Static" />

    Now the problem is that, the Edit/Delete buttons in the Grid are not working. Just nothing is happening if I click on the Edit/Delete buttons, although the ItemCommand event is attached with the grid. The probable reason is that, the grid has to be rebound in every postback to make the paging works properly. The Page_load event handler is like this-

    public void Page_Load(object sender, System.EventArgs e)
                if (IsPostBack)

    Can anyone please assist me in solving this issue?
    Thanks in advance.
  2. Fiko
    Fiko avatar
    1406 posts

    Posted 12 Aug 2010 Link to this post

    Hi Anirban,

    I have already answered your support ticket. For convenience I have pasted my reply:

    "I have made some changes to the provided code in order to run it. I was not able to reproduce the behavior that you experience, however, and I am not quite sure that I completely understood you setup. This is why, could you please rework my test project in order to reproduce the problem (add code for UserControls etc.) and send it back. I will check it and do my best to provide a working solution as soon as possible.

    In addition, I recommend you to check these links. They provide information about how to DataBind the RadGrid control.

    I am looking forward to hearing from you."

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top