I've just spent a while pulling my hair out trying to find out why some text in my repeater control wasn't updating after postback on one page but was on another. The repeater was in a UserControl I'd made, and the same control was on both pages - the only difference - once was inside an AJAX UpdatePanel and on the other page it wasn't.

Here's the offending code:

<ItemTemplate>
    <tr>
       <td><asp:Image runat="server" ImageUrl='<%# Eval("Image") "%>' ID="iImage" /></td>
       <td><%# Eval("Score") %></td>
       <td><%# Eval("Percentage") %></td>
    </tr>
</ItemTemplate>

Now what was strange is that the image was updating ok (this confused me a lot while viewing it as the image is a bar representing the percentage figure and i spent ages working out while the image was wrong - before i noticed that it was the figure that was wrong not the image!)

Once I changed it to the following it worked fine:

<ItemTemplate>
    <tr>
        <td><asp:Image runat="server" ImageUrl='<%# Eval("Image") "%>' ID="iImage" /></td>
        <td><asp:Literal runat="server" Text='<%# Eval("Score") %>' ID="lScore" /></td>
        <td><asp:Literal runat="server" Text='<%# Eval("Percentage") %>' ID="lPercent" /></td>
    </tr>
</ItemTemplate>

The page that wasn't working contained an UpdatePanel holding a Dropdown box that causes my UserControl to rebind its Repeater control... Does anyone know why rebinding in the standard page works in a normal postback but not when inside an AJAX UpdatePanel?


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist
posted @ Wednesday, January 16, 2008 5:22 PM | in C# .NET ASP.NET AJAX

Comments

No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  


Please add 7 and 6 and type the answer here: