ASP.NET UpdatePanelAnimationExtender打印问题

时间:2010-09-29 10:14:39

标签: asp.net-ajax updatepanel

使用UpdatePanel和UpdatePanelAnimationExtender时,我在ASP.NET中打印时遇到问题。我正在UpdatePanel中过滤内容,UpdatePanel内附有UpdatePanelAnimationExtender以添加淡入效果。当页面首次加载时,可以打印Repeater的内容。刷新UpdatePanel后,打印预览会将Repeater内容显示为空白。有谁知道为什么会这样?有没有人找到解决方案?

修改

我忘了提及,这只是IE中的一个问题,而不是FF或Chrome

这是一个基本的测试页面,我已经敲了一下,给出了一个问题的例子(为了便于发布,我只是将所有代码转储到标记中):

    <%@ 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">

<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>

0 个答案:

没有答案