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

User control containing Repeater - only full postback

3 Answers 138 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 14 Aug 2010, 09:02 AM
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!

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 18 Aug 2010, 01:00 PM
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
0
Tim
Top achievements
Rank 1
answered on 18 Aug 2010, 04:58 PM
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.
0
Maria Ilieva
Telerik team
answered on 20 Aug 2010, 02:23 PM
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
Tags
Ajax
Asked by
Tim
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Tim
Top achievements
Rank 1
Share this question
or