0

我想通过 ajax 滚动使转发器数据可滚动,就像 facebook 在新闻提要中所做的那样,这是我的代码,请帮助我,我希望通过页面滚动获取所有这些。

ASPX 页面

<form id="form1" runat="server">

<asp:Repeater ID="RepDetails" runat="server">

<HeaderTemplate>

<table style=" border:1px solid #df5015; width:500px" cellpadding="0">

<tr style="background-color:#df5015; color:White">

<td colspan="2">

<b>Comments</b> 

</td>

</tr>

</HeaderTemplate>

<ItemTemplate>

<tr style="background-color:#EBEFF0">

<td>

<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:500px" >

<tr>

<td>

Subject:

<asp:Label ID="lblSubject" runat="server" Text='<%#Eval("Subject") %>' Font-Bold="true"/>

</td>

</tr> 

</table> 

</td> 

</tr>

<tr>

<td>

<asp:Label ID="lblComment" runat="server" Text='<%#Eval("Comment") %>'/>

</td>

</tr>

<tr>

<td>

<table style="background-color:#EBEFF0;border-top:1px dotted #df5015;border-bottom:1px solid #df5015; width:500px" >

<tr>

<td>Post By: <asp:Label ID="lblUser" runat="server" Font-Bold="true" Text='<%#Eval("UserName") %>'/></td>

<td>Created Date:<asp:Label ID="lblDate" runat="server" Font-Bold="true" Text='<%#Eval("PostedDate") %>'/></td>

</tr>

</table>

</td>

</tr>

<tr>

<td colspan="2">&nbsp;</td>

</tr>

</ItemTemplate>


</table>

    </asp:Repeater>

文件后面的代码

    protected void Page_Load(object sender, EventArgs e)

{

if(!IsPostBack)

{

BindRepeaterData();

}

}



//Bind Data to Repeater Control

protected void BindRepeaterData()

{

con.Open();

SqlCommand cmd = new SqlCommand("select * from Repeater_Table Order By PostedDate desc", con);

DataSet ds = new DataSet();

SqlDataAdapter da = new SqlDataAdapter(cmd);

da.Fill(ds);

RepDetails.DataSource = ds;

RepDetails.DataBind();

con.Close();

}

请帮助我,我希望通过页面滚动获取所有这些内容。

4

2 回答 2

0

I think what you are looking for is typically called "infinite scroll". Try doing a Google search for some examples. Here's one that might be a good start:

http://weedallaboutit.wordpress.com/2011/10/13/infinite-scrolling-with-an-asp-net-webform-jquery-and-a-little-bit-of-code/

于 2013-06-24T20:22:57.930 回答
0

工作示例:

http://www.aspsnippets.com/Articles/Infinite-scroll-images-like-Bing-and-Google-in-ASPNet.aspx

此页面还有下载选项。

于 2014-03-04T05:38:29.683 回答