2013-06-24 38 views
0

我想讓中繼器數據滾動與Ajax滾動就像Facebook在新聞中這樣做是我的代碼 請幫助我我希望所有這些與頁面滾動提取。asp.net中繼器控制滾動與ajax

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(); 

} 

請幫助我,我想所有這些牽強與頁面滾動。

回答