留言簿

我要留言
留言搜索

2007-08-19 23:34  mlwyc

不是啊,我存储过程是这样子的:<br>create procedure GetPage<br>@pagesize int,<br>@pageindex int<br>as<br>set nocount on<br>declare @indextable table(id int identity(1,1),nid int)<br>declare @PageLowerBound int<br>declare @PageUpperBound int<br>set @PageLowerBound=(@pageindex-1)*@pagesize<br>set @PageUpperBound=@PageLowerBound+@pagesize<br>set rowcount @PageUpperBound<br>insert into @indextable(nid) select Novel from Novel  order by N_Click desc<br>select * from Novel O,@indextable t where O.Novel=t.nid<br>and t.id between @PageLowerBound+1 and @PageUpperBound order by t.id<br>set nocount off

2007-08-19 23:16  mlwyc

大哥希望您赶紧给回复解决一下吧<br>谢谢您了<br>麻烦了<br>我也不知道错误到底出在那里<br>反正都是照着您的例子做的:就是您例子里面PagedRepeater文件夹下那个。
回复:应该是这里不对吧: new SqlParameter("@pageindex",SqlDbType.Int),这个参数应该是当前页的索引,即CurrentPageIndex的值,而你的代码中却把StartRecordIndex赋给它了,StartRecordIndex是当前页起始记录的索引,和页索引完全是两回事,请参看帮助文档理解一下。谢谢!

2007-08-19 23:14  mlwyc

cs的:<br>------------<br>protected void Page_Load(object sender, EventArgs e)<br>    {<br>        if (!IsPostBack)<br>        {<br>            DBClass dbc = new DBClass();<br>            dbc.ConnStr = &quot;ConnStr&quot;;<br>            int countPage = dbc.GetCount(&quot;countNovel&quot;, CommandType.StoredProcedure);<br>            AspNetPager1.RecordCount = countPage;<br>            Bind();<br>        }<br>    }<br>    void Bind()<br>    {<br>        DBClass dbc=new DBClass ();<br>        dbc.ConnStr=&quot;ConnStr&quot;;<br>        SqlParameter[] sp =<br>            {<br>                new SqlParameter(&quot;@pagesize&quot;,SqlDbType.Int),<br>                new SqlParameter(&quot;@pageindex&quot;,SqlDbType.Int)<br>            };<br>        sp[0].Value = AspNetPager1.PageSize;<br>        sp[1].Value = AspNetPager1.StartRecordIndex;<br>        Repeater1.DataSource = dbc.ReadData(&quot;GetPageNovel&quot;, CommandType.StoredProcedure,sp);<br>        Repeater1.DataBind();<br>    }<br>    protected void AspNetPager1_PageChanged(object src, EventArgs e)<br>    {<br>        Bind();<br>    }

2007-08-19 23:14  mlwyc

cs的:<br>------------<br>protected void Page_Load(object sender, EventArgs e)<br>    {<br>        if (!IsPostBack)<br>        {<br>            DBClass dbc = new DBClass();<br>            dbc.ConnStr = &quot;ConnStr&quot;;<br>            int countPage = dbc.GetCount(&quot;countNovel&quot;, CommandType.StoredProcedure);<br>            AspNetPager1.RecordCount = countPage;<br>            Bind();<br>        }<br>    }<br>    void Bind()<br>    {<br>        DBClass dbc=new DBClass ();<br>        dbc.ConnStr=&quot;ConnStr&quot;;<br>        SqlParameter[] sp =<br>            {<br>                new SqlParameter(&quot;@pagesize&quot;,SqlDbType.Int),<br>                new SqlParameter(&quot;@pageindex&quot;,SqlDbType.Int)<br>            };<br>        sp[0].Value = AspNetPager1.PageSize;<br>        sp[1].Value = AspNetPager1.StartRecordIndex;<br>        Repeater1.DataSource = dbc.ReadData(&quot;GetPageNovel&quot;, CommandType.StoredProcedure,sp);<br>        Repeater1.DataBind();<br>    }<br>    protected void AspNetPager1_PageChanged(object src, EventArgs e)<br>    {<br>        Bind();<br>    }

2007-08-19 23:14  mlwyc

晕了,超过字了,我就贴前后台关键代码好了:<br>&lt;%@ Register Assembly=&quot;AspNetPager&quot; Namespace=&quot;Wuqi.Webdiyer&quot; TagPrefix=&quot;webdiyer&quot; %&gt;<br><br>&lt;webdiyer:aspnetpager id=&quot;AspNetPager1&quot; runat=&quot;server&quot; width=&quot;100%&quot; urlpaging=&quot;true&quot;<br>                horizontalalign=&quot;left&quot; pagesize=&quot;5&quot; onpagechanged=&quot;AspNetPager1_PageChanged&quot;<br>                enabletheming=&quot;true&quot;&gt;<br>        &lt;/webdiyer:aspnetpager&gt;<br>--------------

2007-08-19 23:11  mlwyc

因为自运行不过去,我参照了您的例子自己做了个,但是在翻页的时候第二页都不显示:我的代码如下:<br>html: <br>-------------------<br>&lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeFile=&quot;PageTest.aspx.cs&quot; Inherits=&quot;Novel_PageTest&quot; %&gt;<br>&lt;%@ Register Assembly=&quot;AspNetPager&quot; Namespace=&quot;Wuqi.Webdiyer&quot; TagPrefix=&quot;webdiyer&quot; %&gt;<br><br>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br>&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br>&lt;head runat=&quot;server&quot;&gt;<br>    &lt;title&gt;无标题页&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;<br>        &lt;div&gt;<br>            &lt;asp:Repeater ID=&quot;Repeater1&quot; runat=&quot;server&quot;&gt;<br>                &lt;HeaderTemplate&gt;<br>                    &lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;<br>                        &lt;tr&gt;<br>                            &lt;td&gt;<br>                                小说ID&lt;/td&gt;<br>                            &lt;td&gt;<br>                                小说作者&lt;/td&gt;<br>                            &lt;td&gt;<br>                                点击&lt;/td&gt;<br>                            &lt;td&gt;<br>                                时间&lt;/td&gt;<br>                        &lt;/tr&gt;<br>                &lt;/HeaderTemplate&gt;<br>                &lt;ItemTemplate&gt;<br>                    &lt;tr&gt;<br>                        &lt;td&gt;<br>                            &lt;%#DataBinder.Eval(Container.DataItem, &quot;Novel&quot;)%&gt;<br>                        &lt;/td&gt;<br>                        &lt;td&gt;<br>                            &lt;%#DataBinder.Eval(Container.DataItem, &quot;N_Author&quot;)%&gt;<br>                        &lt;/td&gt;<br>                        &lt;td&gt;<br>                            &lt

2007-08-19 23:03  mlwyc

老大给帮忙看看吧,我下了你的例子可是运行不过去,我的是vs2005+sql2000.老报一个错误:<br>错误	1	未能从程序集“System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”中加载类型“System.Web.UI.Compatibility.CompareValidator”。 (E:\My.dll\技术资料备份\AspNetPager\AspNetPagerSamples\web.config line 23)	E:\My.dll\技术资料备份\AspNetPager\AspNetPagerSamples\NavPage.master	15
回复:搜索一下前面的留言,或者直接看这个搜索结果,这个问题是因为示例中用的Asp.Net Ajax是beta版的,正式版发生了变化导致的。

2007-08-19 17:00  cannycsy

但如我一页有20条数据,我想分5行4列来显示就设为如下,为什么不行呢?<br>&lt;asp:DataList ID=&quot;rptList&quot; runat=&quot;server&quot; RepeatColumns=&quot;4&quot; Width=&quot;175px&quot;&gt;<br>                    &lt;ItemTemplate&gt;<br>'中间读取数据部分,就是显示数据在这里<br>                    &lt;/ItemTemplate&gt;<br>				&lt;/asp:DataList&gt;<br>如果我加上RepeatColumns=&quot;4&quot; 就会出错了.请问是什么回事?我的EMAIL是:gd-csy@163.com<br>请回答,谢谢.
回复:加上RepeatColumns="4"后出现什么错误呢?是分页控件出错了吗?请帖出错误信息,这段代码看不出有什么问题。谢谢!

2007-08-19 16:11  xifan930

娃娃问个问题哈<br>我在使用Url重写分页的时候遇到一个问题<br>我当前页 用了url重写 并且重写带了参数了<br>比如 我当前URL为 Thread_3.aspx <br>那么我分页的话应该是<br>Thread_3_分页页数.aspx<br>那么在UrlRewritePattern=&quot;&quot;这里怎么写?
回复:应该是“Thread_3_{0}.aspx”,请参考帮助文档中的详细说明,谢谢。

2007-08-19 15:54  marsLi

非常感谢!祝你成功!
回复:谢谢!
;