读书人

用AspNetPager+Datalist 如何在页面绑

发布时间: 2012-12-17 09:31:40 作者: rapoo

用AspNetPager+Datalist 怎么在页面绑定数据


[最优解释]

this.DataBind();

[其他解释]
少些了this.Repeater1.DataBind();
[其他解释]
你可以在官方网站,查看案例,上面有案例使用说明
[其他解释]
<asp:Repeater ID="Repeater1" runat="server" ViewStateMode="Enabled">
<ItemTemplate>
<div class="div_moudle">
<div class="div_m_title">
<%-- <%# Eval("S_name")%>--%>
</div>
<asp:Datalist ID="DataList1" runat="server" DataSource='<%# Eval("TopicList") %>'>
<ItemTemplate>
<table id="table1" style="width:100%;padding-top:0px; height:40px; text-align:center; ">
<tr>
<td style="width:100px;padding-top:0px;text-align:center;" >
<tt><%# GetReplyCount(Convert.ToInt32(Eval("T_id").ToString()))%></tt>
<tt></tt>
</td>
<td style="width:600px;text-align:left;padding-top:0px;"><a href='<%# Eval("T_id","TopicReply.aspx?id={0}") %>' target="_blank"> <%# Eval("T_title")%></a></td>
<td style="width:100px;padding-top:0px;">
<tt style="width:250px;">
<a href="#" target="_blank"><%# GetEditer( Convert.ToInt32( Eval("U_id")))%></a>
</tt>


<br />
<tt style="text-align:center">
<%# GetLastReplyAuthor(Eval("T_id").ToString())%>
</tt>
</td>
</tr>

</table>
</ItemTemplate>
</asp:Datalist>

</div>
</ItemTemplate>
</asp:Repeater>
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" PageSize="5">
</webdiyer:AspNetPager>


[其他解释]
 private void PageUp()
{

string id = Request.QueryString["id"];
string strWhere = "s_id=" + id;

int count = new TopicManager().GetpageCount(strWhere);
this.Repeater1.DataSource = new TopicManager().getPage(AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex, strWhere, 0);
this.AspNetPager1.RecordCount =count;//count/this.AspNetPager1.PageSize;
this.AspNetPager1.AlwaysShow = true;

}


数据已读取 就是不知道怎么没绑定

读书人网 >asp.net

热点推荐