我在以前各位大虾说的网址下载了分页控件,并且安装好了,也拖在了网页上,那怎么才能实现分页呢??
应该在那些地方添加程序啊??添些什么程序呢,有没有那位大虾用过,帮下忙,程序给份给我,好不?我的是动态查询,数据显示在datagrid中

解决方案 »

  1.   

    webdiyer的分页控件??是什么????
      

  2.   

    就是在www.webdiyer.com上去下载的那个分页控件,但如何才能实现分页呢??
      

  3.   

    protected void BindGrid()
    {
    string sqlcount,sql,cond="";
    if(string.Empty.Equals(Txbsearch.Text))
    {
    cond = "";
    }
    else if(!wst.common.RegexCheck.NumericCheck(Txbsearch.Text))
    {
    Response.Write("<script language='javascript'>alert('只能输入数字!');</script>");

    }
    else
    {
    cond = "where Cardid = "+Txbsearch.Text;
    }
    //得到总记录数
    sqlcount = "select count(Cardid) as 总记录数 from CardInfo "+cond;
    SqlDataReader dr = um.ExcuteRead(sqlcount);
    if(dr.Read())
    {
    aspager.RecordCount = (int)dr["总记录数"];
    }
    dr.Close(); sql = "select * from CardInfo "+cond+" order by Cardid ";
    DataView dv = um.ExcuteGet(sql,aspager.PageSize*(aspager.CurrentPageIndex-1),aspager.PageSize,"CardInfo").Tables["CardInfo"].DefaultView;
    MyDataGrid.DataSource = dv;
    MyDataGrid.DataBind();
    aspager.CustomInfoText="记录总数:<font color=\"blue\"><b>"+aspager.RecordCount.ToString()+"</b></font>";
    aspager.CustomInfoText+=" 总页数:<font color=\"blue\"><b>"+aspager.PageCount.ToString()+"</b></font>";
    aspager.CustomInfoText+=" 当前页:<font color=\"red\"><b>"+aspager.CurrentPageIndex.ToString()+"</b></font>";
    }
    //翻页函数
    private void aspager_PageChanged(object src, Wuqi.Webdiyer.PageChangedEventArgs e)
    {
    aspager.CurrentPageIndex=e.NewPageIndex;
    BindGrid();
    System.Text.StringBuilder sb=new StringBuilder("<script Language=\"Javascript\"><!--\n");
    sb.Append("var el=document.all;");
    sb.Append(MyDataGrid.ClientID);
    sb.Append(".scrollIntoView(true);");
    sb.Append("<");
    sb.Append("/");
    sb.Append("script>");
    if(!Page.IsStartupScriptRegistered("scrollScript"))
    Page.RegisterStartupScript("scrollScript",sb.ToString());
    }
      

  4.   

    控件的安装目录下有详细的示例代码,还有vsproj.rar是用vs.net创建的示例项目。
      

  5.   

    吴大哥,我的安装目录下就只有一个AspNetPager.dll,其它什么都没有啊???
      

  6.   

    <HTML>
    <HEAD>
    <title>searchwagemessage</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="C#" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    <SCRIPT language="javascript" src="js\popup.js"></SCRIPT>
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:panel id="Panel1" style="Z-INDEX: 101; LEFT: 40px; POSITION: absolute; TOP: 112px" runat="server"
    Height="336px" Width="448px"></asp:panel><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT>
    <TABLE id="Table2" style="Z-INDEX: 105; LEFT: 8px; WIDTH: 592px; POSITION: absolute; TOP: 112px; HEIGHT: 361px"
    cellSpacing="1" cellPadding="1" width="592" border="1">
    <TR>
    <TD style="HEIGHT: 11px" align="center" bgColor="#0099cc"><FONT face="宋体"><FONT face="宋体"><STRONG><FONT face="宋体"><FONT face="宋体" color="#ff0033"><STRONG>员工工资查询</STRONG></FONT></FONT></STRONG></FONT></FONT></TD>
    </TR>
    <TR>
    <TD style="HEIGHT: 234px" align="center" bgColor="#ffffcc" colSpan="1" rowSpan="1">
    <asp:Label id="Label2" runat="server" ForeColor="#400040" Font-Size="10">从</asp:Label>
    <asp:TextBox id="TextBox2" runat="server" Width="69px" ReadOnly="True"></asp:TextBox><A onclick="fPopUpDlg('js/date.htm', document.forms[0].TextBox2, 'winpop',300,100, 234, 261);return false"
    href="#"><IMG src="js\datetime.gif" border="0"></A>
    <asp:Label id="Label3" runat="server" ForeColor="#400040" Font-Size="10">到 </asp:Label>
    <asp:TextBox id="TextBox3" runat="server" Width="69px" ReadOnly="True"></asp:TextBox><A onclick="fPopUpDlg('js/date.htm', document.forms[0].TextBox3, 'winpop',300,100, 234, 261);return false"
    href="#"><IMG src="js\datetime.gif" border="0"></A>
    <asp:Label id="Label1" runat="server" Font-Size="10" ForeColor="#400040">员工编号</asp:Label>
    <asp:TextBox id="TextBox1" runat="server" Width="84px"></asp:TextBox>
    <asp:Button id="Button1" runat="server" Text="执行查询"></asp:Button><A onclick="fPopUpDlg('js/date.htm', document.forms[0].TextBox2, 'winpop',300,100, 234, 261);return false"
    href="#"></A>
    <DIV style="OVERFLOW: auto; WIDTH: 581px; HEIGHT: 208px">
    <asp:DataGrid id="DataGrid1" runat="server" Width="570px" Height="64px" AllowCustomPaging="True"
    AllowPaging="True" AutoGenerateColumns="False" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
    BackColor="White" CellPadding="3" DataKeyField="ygid" ToolTip="双击查看详细信息" HorizontalAlign="Center">
    <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#669999"></SelectedItemStyle>
    <ItemStyle ForeColor="#000066"></ItemStyle>
    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="White" BackColor="#006699"></HeaderStyle>
    <FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
    <Columns>
    <asp:TemplateColumn>
    <HeaderStyle Width="5px"></HeaderStyle>
    <ItemTemplate>
    <asp:CheckBox id="CB" runat="server"></asp:CheckBox>
    </ItemTemplate>
    </asp:TemplateColumn>
    <asp:BoundColumn DataField="ygid" HeaderText="员工编号">
    <HeaderStyle Font-Size="10pt" Width="100px"></HeaderStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="dixin" HeaderText="底薪">
    <HeaderStyle Font-Size="10pt" Width="100px"></HeaderStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="jlwage" HeaderText="奖金">
    <HeaderStyle Width="100px"></HeaderStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="chengfwage" HeaderText="惩罚金">
    <HeaderStyle Width="100px"></HeaderStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="sfwage" HeaderText="实发工资">
    <HeaderStyle Font-Size="10pt" Width="100px"></HeaderStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="wagedate" HeaderText="日期 ">
    <HeaderStyle Font-Size="10pt" Width="100px"></HeaderStyle>
    </asp:BoundColumn>
    </Columns>
    <PagerStyle Visible="False" NextPageText="下一页" PrevPageText="上一页" HorizontalAlign="Left" ForeColor="#000066"
    BackColor="White" Mode="NumericPages"></PagerStyle>
    </asp:DataGrid></DIV>
    </TD>
    </TR>
    <TR>
    <TD style="HEIGHT: 4px" vAlign="top" bgColor="#ffffcc"><FONT face="宋体"></FONT></TD>
    </TR>
    <TR>
    <TD style="HEIGHT: 1px" align="center" bgColor="#0099cc" colSpan="1" rowSpan="1">
    <asp:Button id="Button2" runat="server" Text="删除" Enabled="False"></asp:Button>
    <asp:Button id="Button3" runat="server" Text="取消"></asp:Button></TD>
    </TR>
    <TR>
    <TD align="center"><FONT face="宋体">
    <webdiyer:AspNetPager id="AspNetPager1" runat="server" HorizontalAlign="Right" ShowInputBox="Always" SubmitButtonText="GO"
    ShowCustomInfoSection="Left" Wrap="False" TextBeforeInputBox="转到第" TextAfterInputBox="页" InputBoxStyle="border:1px #0000FF solid;text-align:center"></webdiyer:AspNetPager></FONT></TD>
    </TR>
    </TABLE>
    <asp:label id="Message" style="Z-INDEX: 102; LEFT: 256px; POSITION: absolute; TOP: 80px" runat="server"
    Width="152px" Font-Size="15px" ForeColor="Red" Font-Bold="True"></asp:label><asp:button id="Button4" style="Z-INDEX: 103; LEFT: 72px; POSITION: absolute; TOP: 72px" runat="server"
    Text="Button"></asp:button><asp:label id="Message1" style="Z-INDEX: 104; LEFT: 136px; POSITION: absolute; TOP: 80px" runat="server"
    Width="88px" Font-Size="10pt" ForeColor="Red" Font-Bold="True"></asp:label></form>
    </body>
    </HTML>这是前台代码,那位好心的大虾帮忙看一下,应该怎么实现分页