views:

26

answers:

0

I'm having problems printing in ASP.NET when using an UpdatePanel and UpdatePanelAnimationExtender. I am filtering content in a Repeater which is inside an UpdatePanel with an UpdatePanelAnimationExtender attached to add a fade in effect. When the page first loads the content of the Repeater can be printed. After the UpdatePanel is refreshed a print preview shows the Repeater content to be blank. Does anyone know why this is occurring? Has anyone found a solution?

EDIT

I forgot to mention, this is only a problem in IE, not FF or Chrome

Here is a basic test page I've knocked together which gives an example of the problem (for ease of posting I've just dumped all the code in the markup):

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="TestUpdatePanelPrint._Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<script runat="server">
    Dim myList As New List(Of Integer)

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        myList.Add(1)
        myList.Add(2)
        myList.Add(3)
        myList.Add(4)

        Filter(-1)
    End Sub

    Protected Sub Filter(ByVal number As Integer)
        Dim filtered As List(Of Integer) = myList

        If (number > 0) Then
            filtered = myList.Where(Function(x) x = number).ToList()
        End If

        repeater.DataSource = filtered
        repeater.DataBind()
    End Sub

    Private Sub button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button.Click
        Filter(CInt(list.SelectedValue))
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>

    <form id="form1" runat="server">
    <asp:ScriptManager ID="script" runat="server"></asp:ScriptManager>
    <div>
        <asp:ListBox ID="list" runat="server">
            <asp:ListItem Text="-1" Value="-1" />
            <asp:ListItem Text="1" Value="1" />
            <asp:ListItem Text="2" Value="2" />
            <asp:ListItem Text="3" Value="3" />
        </asp:ListBox>

        <asp:Button ID="button" text="Filter" runat="server" />

        <br />

        <ajax:UpdatePanelAnimationExtender id="upExSearch" runat="server"
            TargetControlID="UpdatePanel1">
            <Animations>
                <OnUpdated>
                    <FadeIn duration=".25" Fps="30" />
                </OnUpdated>
            </Animations>
        </ajax:UpdatePanelAnimationExtender>

        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="button" EventName="Click" />
            </Triggers>
            <ContentTemplate>
                <ul>
                    <asp:Repeater ID="repeater" runat="server">
                        <ItemTemplate>
                            <li><%# Container.DataItem %></li>
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>

related questions