Bug reports Found a bug? Post it here please.
Version 6.x > Bug reports > UpdatePanel inside of Repeater Fails on Async PostBack View modes: 
User avatar
Member
Member
njbraun-gmail - 1/5/2014 4:57:07 AM
   
UpdatePanel inside of Repeater Fails on Async PostBack
When using an Update Panel inside of a Repeater, the postback does not update the repeater's UpdatePanel on first click, and on second click, all Items from the Repeater are removed.

I suspect ToolkitScriptManager is doing something evil here.

I've tried the following code in a seperate NON-KENTICO project and it works flawlessly, but when inserted into an Template and Used in Kentico, I get issues.

<asp:Repeater ID="REPE" runat="server">

<ItemTemplate>
<cms:CMSUpdatePanel ID="UPDA" runat="server">
<ContentTemplate>
<asp:Label id="HEL" runat="server" Text="HELLO SON"></asp:Label>
<asp:Button ID="DSAFSDFSDF" runat="server" Text="asdfasdf" ClientIDMode="AutoID" OnClick="DSAFSDFSDF_Click"/>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DSAFSDFSDF" />
</Triggers>
</cms:CMSUpdatePanel>
</ItemTemplate>

</asp:Repeater>



protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<int> bob = new List<int>();
bob.Add(1);
bob.Add(1);
bob.Add(1);
REPE.DataSource = bob;
REPE.DataBind();
}
}

protected void DSAFSDFSDF_Click(object sender, EventArgs e)
{

Label hg = ((Control)sender).Parent.FindControl("HEL") as Label;
hg.Text = "SDFSD";
}




User avatar
Member
Member
njbraun-gmail - 1/5/2014 12:58:48 PM
   
RE:UpdatePanel inside of Repeater Fails on Async PostBack
The UpdatePanel in the above code should just be an

<asp:UpdatePanel> control.


<asp:Repeater ID="REPE" runat="server">
<ItemTemplate>
<asp:UpdatePanel ID="UPDA" runat="server">
<ContentTemplate>
<div>HELLO WORLD</div>
<asp:Button ID="DSAFSDFSDF" runat="server" Text="asdfasdf" ClientIDMode="AutoID"/>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DSAFSDFSDF" />
</Triggers>
</asp:UpdatePanel>
</ItemTemplate>
</asp:Repeater>

User avatar
Member
Member
njbraun-gmail - 1/6/2014 12:31:35 AM
   
RE:UpdatePanel inside of Repeater Fails on Async PostBack
The fix was the following:

The AsyncPostBackTrigger was causing a full page PostBack and my Repeater Datasource was reload on each full page PostBack.

I had to move the DataSource assignment and DataBind() for the Repeater into the Page_Init() method.