0

I have a repeater which shows some detail from database. I want when a new row is added in database the repeater should also update dynamically.I done this by placing repeater in update panel and placing a timer in it. is there any other method for it in js or javascript or any.also I want when a record is added it added with an effect(slide down,fadein) just like facebook side notification bar.

4

2 回答 2

1

尝试这个

页面加载绑定中继器

    protected void Page_Load(object sender, EventArgs e)
    {
        lbl.Text = System.DateTime.Now.ToString();
        rptData.DataSource = YourDataSource;
        rptData.DataBind();
    }


<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
    <ContentTemplate>
        <asp:Timer ID="Timer1" runat="server" Interval="1000">
        </asp:Timer>
**timer for postback at some interval**
**you can remove label**
        <asp:Label Text="text" runat="server" ID="lbl" />
        <asp:Repeater runat="server" ID="rptData">
            <ItemTemplate>
**your repeater**
            </ItemTemplate>
        </asp:Repeater>
    </ContentTemplate>
</asp:UpdatePanel>

在计时器间隔页面将回发,您可以获得更新的记录

于 2013-08-07T05:29:45.693 回答
1

您可以将转发器包装到一个 div 中,并通过类名访问它使 display:none of this div <div class="abc>" and in script

 $(document).ready(function () {
            $('.abc').click(function () {
                $('.show').SlideDown('slow');
            });
        });
        $(document).ready(function () {
            $(".abc").trigger('click')
        });
于 2013-08-07T09:21:16.500 回答