User control containing Repeater - only full postback

4 posts, 0 answers
  1. Tim
    Tim avatar
    3 posts
    Member since:
    Feb 2009

    Posted 14 Aug 2010 Link to this post

    I have a web user control which contains a Repeater control inside a RadAjaxPanel.  The Repeater control has an ItemTemplate which contains several table columns, one of which is a RadNumericTextBox.

    What I want to happen is, when the user changes the value in the RadNumericTextBox it should via Ajax refresh the Repeater control.  What is actually happening is a full page-postback.

    Here is the ascx code:

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ShoppingBasketPanel.ascx.cs" Inherits="myapp.Controls.ShoppingBasketPanel" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <div>
        <div style="margin-top:10px; clear:both;">
              
        </div>
        <div style="width: 600px; margin: auto;">
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Width="600px" EnableAJAX="true"
                LoadingPanelID="RadAjaxLoadingPanel1" EnablePageHeadUpdate="True"
                HorizontalAlign="NotSet">
             
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default" />
            <asp:Repeater ID="rptBasket" runat="server" onitemdatabound="rptBasket_ItemDataBound">
                <HeaderTemplate>
                    <table style="width: 100%;">
                        <thead>
                            <tr>
                                <th align="left">Quantity</th>
                                <th align="left">Product</th>
                                <th align="right">Item Price</th>
                                <th align="right">Item Total</th>
                                <th> </th>
                                <th> </th>
                            </tr>
                        </thead>
                </HeaderTemplate>
     
                <ItemTemplate>
                    <tr>
                        <td align="left"><telerik:RadNumericTextBox ID="txtQuantity" runat="server" MaxLength="3" MinValue="1" MaxValue="999" Width="40px"
                                                DataType="System.Int32" ShowSpinButtons="True" NumberFormat-DecimalDigits="0" AutoPostBack="True"
                                                OnTextChanged="txtQuantity_OnTextChanged" /></td>
                        <td align="left"><asp:Label ID="lblProduct" runat="server" /></td>
                        <td align="right"><asp:Label ID="lblItemPrice" runat="server" /></td>
                        <td align="right"><asp:Label ID="lblTotal" runat="server" /></td>
                        <td><asp:HiddenField ID="hfCode" runat="server" /><asp:HiddenField ID="hfOption" runat="server" /> </td>
                        <td style="margin-left:5px;"><asp:ImageButton ID="imgbRemove" runat="server" ImageUrl="~/Images/delete.png" Width="16" Height="16" /></td>
                    </tr>
                </ItemTemplate>
     
                <FooterTemplate>
                        <tfoot>
                            <tr>
                                <td> </td>
                                <td> </td>
                                <td colspan="2" align="right"><strong>Total  </strong><asp:Label ID="lblBasketTotal" runat="server" Text="0" /></td>
                                <td> </td>
                                <td> </td>
                            </tr>
                        </tfoot>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
     
            </telerik:RadAjaxPanel>
        </div>
    </div>

    The txtQuantity_OnTextChanged method does some internal processing and then:

    rptBasket.DataSource = CartItems;
    rptBasket.DataBind();

    The Page_Load method doesn't do anything unless IsPostBack is FALSE.

    The aspx page containing the user control has no Ajax on it.  Any assistance much appreciated!
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 18 Aug 2010 Link to this post

    Hi Tim,

    The provided code looks ok to me except that the LoadingPanel control should be outside the RadAjaxPanel tag. Also please confirm that you have script manager control in the very top of the page before all other controls.


    Greetings,
    Maria Ilieva
    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
  3. Tim
    Tim avatar
    3 posts
    Member since:
    Feb 2009

    Posted 18 Aug 2010 Link to this post

    Thanks for the tip about the RadAjaxLoadingPanel; I have moved that outside of the RadAjaxPanel though it has not cured the full-postback issue.

    This user control sits within an ASPX file which has a Master page. The ScriptManager is on the Master page. 

    Edit: I have now wired up the rptBasket_ItemCommandevent which is fired when the imgbRemove button within the ItemTemplate is pressed and it's event bubbles up, and this refreshes the repeater via AJAX with the loading panel showing just fine.  Odd that one control within the ItemTemplate does, and another (the RadNumericTextBox) does not.

    It does at least confirm the AJAX is wired up correctly on the control, if not why it doesn't fire for that one control.
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 20 Aug 2010 Link to this post

    Hi Tim,

    The provided information is not enough to isolate the root cause of the issue you are facing. Could you please open a regular support ticket and send us sample runnbale application so we could debug it locally and provide more to-the-point solution.

    All the best,
    Maria Ilieva
    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