1

I have a repeater whose records load on scrolling down main browser window but i want to add a scrollable div and load repeater on scrolling down that div instead of the main browser window. This is what i have right now..

http://snag.gy/MKKFn.jpg (this one is working just fine, i am able to load repeater records on browser window scroll down).

This is what i want to achieve.. http://snag.gy/n9Ufw.jpg (i have added scrollable div and now i do not know how to load repeater on scrolling this div instead of browser window).

ASPX:

<div id="scr" style="height:400px;overflow-x:hidden;overflow-y: scroll;>
    <div id="dvCustomers" >    
   <asp:Repeater ID="rptCustomers" runat="server" >
            <ItemTemplate>
                <table cellpadding="0" cellspacing="0" border="0" style="width: 400px; height: 50px;
                border: dashed 0px #04AFEF; background-color:#00BFFF">
                <tr>
                    <td>
                        <b><u><span class="name">
                            <%# Eval("MsgId") %></span></u></b>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>City: </b><span class="city"><%# Eval("FromId") %></span>&nbsp&nbsp&nbsp&nbsp&nbsp
                        <b>Postal Code: </b><span class="postal"><%# Eval("ToId") %></span>
                        <b>Country: </b><span class="country"><%# Eval("Msg")%></span>                                          
                    </td>
                </tr>
            </table>

            </ItemTemplate>
        </asp:Repeater>
      </div>
 </div>

code to load repeater:

<script type="text/javascript">
    var pageIndex = 1;
    var pageCount;



    $(window).scroll(function () {
        if ($(window).scrollTop() == $(document).height() - $(window).height()) {
            GetRecords();
        }
    });
//GetRecords() is for loading records in repeater 

UPDATE I tried ....

https://stackoverflow.com/a/6271466/2064292

And it worked! But strangely it loads records just once and then stops working. For example if there are 22 records then on scrolling down 10-20 records get loaded but after that it stops functioning.

It did not work.

Community
  • 1
  • 1
SamuraiJack
  • 5,131
  • 15
  • 89
  • 195

1 Answers1

0

This worked..https://stackoverflow.com/a/6271466/2064292 But i it was working just once i.e records were loading just once on scrolling down and then stopped working so i changed #flux{width:400px;height:400px;overflow:auto;} in that answer to inline

style="width:400px;height:400px;overflow-x:hidden;overflow:-y:scroll;

It solved everything.

Community
  • 1
  • 1
SamuraiJack
  • 5,131
  • 15
  • 89
  • 195