asp.net转发器控件使用ajax滚动

时间:2013-06-24 19:24:20

标签: asp.net ajax asp.net-ajax

我想使用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();

}

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

2 个答案:

答案 0 :(得分:0)

我认为你所寻找的通常被称为“无限卷轴”。尝试在谷歌搜索一些例子。这可能是一个好的开始:

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

答案 1 :(得分:0)