<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/NJUTDW.mdb" SelectCommand="SELECT top 7 * FROM [news] WHERE ([classid] = ?) ORDER BY [addtime] DESC">
<SelectParameters>
<asp:Parameter DefaultValue="8" Name="classid" Type="Int32" />
</SelectParameters>
</asp:AccessDataSource>
这个sql怎么把符合classid的全取出来了啊,我用repeater呈现的~~
解决方案 »
- csdn博客的链接是怎样实际的
- 关于Iprincipal的问题
- 如何使一条数据同时只能由一个人读取?
- 求教:DataGird中加入模版列中遇到的问题
- 关于Page.RegisterStartupScript()的一些问题
- 一个关于Session的问题,请大家帮忙解答,不理解。帮顶有分~~~!
- .NET连接ACCESS没有反应怎么弄
- 用GridView来展示员工签到的情况 是怎么样一个思路 ?
- 有哪位会呀,快救急了
- 谁有在asp.net下弹出窗口,并取得值的例子呀(VB),给我一份吧,很急的.谢了
- 把execl 导入数据库中出错———服务器上出现Microsoft Jet 数据库引擎打不开文件''。 它已经被别的用户以独占方式打开,或没有查看数据的权限
- 页面正常表示,但是如果按下F11后,全屏表示的话,也让页面相应全屏表示应该如何处理?
这样不行吗?楼主啥意思
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="AccessDataSource1" >
<ItemTemplate >
<table class="fixedTable" width="323">
<tr>
<td width="10">
<asp:Image ID="Image1" runat="server" ImageUrl="../pic/news_icon.gif" />
</td>
<td width="273">
<asp:HyperLink ID="HyperLink1" runat="server" Font-Names="宋体" Font-Size="Small" Font-Underline="False" ToolTip ='<%#eval("title") %>' NavigateUrl='<%# "../detailview.aspx?id=" & container.dataitem("id").toString %>'
Text='<%# iif(Eval("title").length>19,left(eval("title"),19) & "…",eval("title")) %>'></asp:HyperLink>
</td>
<td width="90">
[<asp:Label ID="Label1" runat="server" Text='<%# Eval("addtime", "{0:d}") %>'></asp:Label>
]</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
我看我的accessdatasource,还有repeater 都没有分页的属性啊?
<asp:LinkButton ID="btnPrevious" runat="server" OnClick ="btnPrevious_Click">上一页</asp:LinkButton>
(<asp:Label ID="lblPageIndex" runat="server" Text="Label"></asp:Label>/<asp:Label ID="lblPageCount"
runat="server" Text="Label"></asp:Label>)
<asp:LinkButton ID="btnNext" runat="server" OnClick ="btnNext_Click">下一页</asp:LinkButton>
<asp:LinkButton ID="btnLast" runat="server" OnClick ="btnLast_Click">最后一页</asp:LinkButton>在后台加protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
pds.AllowPaging = true;//允许分页
pds.CurrentPageIndex = 0;//当前页的索引设置为0,即第一页的索引为0
pds.PageSize = 4;//单页显示的项数 }
RefreshStatus(); }
private void RefreshStatus()
{
DataView dv = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);
pds.DataSource =dv ;
DataList1.DataSource = pds;
DataList1.DataBind(); btnFirst.Enabled = !pds.IsFirstPage;//判断当前页是不是第一页,如果是,那么"第一页"的按钮就应该不可用
btnPrevious.Enabled = !pds.IsFirstPage;//判断当前页是不是第一页,如果是,那么"上一页"的按钮就应该不可用
btnNext.Enabled = !pds.IsLastPage;
btnLast.Enabled = !pds.IsLastPage;
lblPageIndex.Text = Convert.ToString(pds.CurrentPageIndex + 1);//如果当前页是第一页,pds.CurrentPageIndex的值会为0,所以要+1
lblPageCount.Text = pds.PageCount.ToString();
} protected void btnFirst_Click(object sender, EventArgs e)
{
pds.CurrentPageIndex = 0;//如果是第一页,就把pds.CurrentPageIndex参数设置为0,然后在绑定
RefreshStatus();
} protected void btnLast_Click(object sender, EventArgs e)
{
pds.CurrentPageIndex = pds.PageCount - 1;
RefreshStatus();
} protected void btnNext_Click(object sender, EventArgs e)
{
pds.CurrentPageIndex += 1;
RefreshStatus();
} protected void btnPrevious_Click(object sender, EventArgs e)
{
pds.CurrentPageIndex -= 1;
RefreshStatus();
}
就实现分页了
..........
楼主好样的。 还有这么取数据的啊。两种方式, 一种,存储过程分页。 每次穿当前页和每页显示多少条。直接返回给你数据。2.使用GridView 这个控件自带分页。 你的数据源 直接 select * 就行。repeater没有分页,
想要不用存储过程,又要用repeater 就只能在itemdatabound事件去写去了