带搜索的分页控件之二
点击次数:22 次 发布日期:2008-11-26 10:59:04 作者:源代码网
|
源代码网推荐 /******************************************************************** 源代码网推荐 * FileName : pagefootdesign.cs 源代码网推荐 * Target : 翻页控件设计器 源代码网推荐 * Author : Baihao 源代码网推荐 * CreateDate : 2003/04/17 10:22 源代码网推荐 * LastModify : 2003/04/17 10:22 源代码网推荐 * History : 源代码网推荐 2003/04/17 10:22 创建 源代码网推荐 *********************************************************************/ 源代码网推荐 源代码网推荐 using System; 源代码网推荐 using System.IO; 源代码网推荐 using System.Web; 源代码网推荐 using System.Web.UI; 源代码网推荐 using System.Web.UI.WebControls; 源代码网推荐 using System.Web.UI.Design; 源代码网推荐 源代码网推荐 namespace EII.Lib.WebControls.Design 源代码网推荐 { 源代码网推荐 /// <summary> 源代码网推荐 /// PageFootDesign 的摘要说明。 源代码网推荐 /// </summary> 源代码网推荐 public class PageFootDesign: System.Web.UI.Design.ControlDesigner 源代码网推荐 { 源代码网推荐 源代码网推荐 public override string GetDesignTimeHtml() 源代码网推荐 { 源代码网推荐 // Component is the control instance, defined in the base 源代码网推荐 // designer 源代码网推荐 源代码网推荐 PageFoot page = (PageFoot ) Component; 源代码网推荐 源代码网推荐 if (page.CurrentPage != "" && page.CurrentPage != null ) 源代码网推荐 { 源代码网推荐 StringWriter sw = new StringWriter(); 源代码网推荐 HtmlTextWriter tw = new HtmlTextWriter(sw); 源代码网推荐 源代码网推荐 HyperLink placeholderLink = new HyperLink(); 源代码网推荐 源代码网推荐 // put control text into the link"s Text 源代码网推荐 placeholderLink.Text = page.CurrentPage ; 源代码网推荐 placeholderLink.NavigateUrl = page.CurrentPage ; 源代码网推荐 placeholderLink.RenderControl(tw); 源代码网推荐 源代码网推荐 源代码网推荐 源代码网推荐 //placeholderLink.NavigateUrl = show.Width; 源代码网推荐 placeholderLink.RenderControl(tw); 源代码网推荐 源代码网推荐 return sw.ToString(); 源代码网推荐 } 源代码网推荐 else 源代码网推荐 return GetEmptyDesignTimeHtml(); 源代码网推荐 } 源代码网推荐 } 源代码网推荐 } 源代码网推荐 源代码网推荐 3, 使用方法 源代码网推荐 a:aspx 源代码网推荐 源代码网推荐 源代码网推荐 <%@ Register TagPrefix="Wonders" Namespace="EII.Lib.WebControls" Assembly="EII.Lib" %> 源代码网推荐 ... 源代码网推荐 <TR> 源代码网推荐 <TD align="center"><Wonders:PAGEFOOT id="WFoot" runat="server"></Wonders:PAGEFOOT></TD> 源代码网推荐 </TR> 源代码网推荐 ... 源代码网推荐 b : .cs 源代码网推荐 private void Page_Load(object sender, System.EventArgs e) 源代码网推荐 { 源代码网推荐 if(!this.IsPostBack ) 源代码网推荐 { 源代码网推荐 源代码网推荐 try 源代码网推荐 { 源代码网推荐 nPage = Convert.ToInt32(Request[WFoot.PageIndex]); 源代码网推荐 } 源代码网推荐 catch 源代码网推荐 { 源代码网推荐 nPage = 1; 源代码网推荐 } 源代码网推荐 源代码网推荐 //自定义业务层,请修改 源代码网推荐 Department dept = new Department(); 源代码网推荐 源代码网推荐 DataSet ds = dept.QueryAllDeptByID(DeptID); 源代码网推荐 源代码网推荐 if(ds != null && (ds.Tables.Count >0)) 源代码网推荐 { 源代码网推荐 this.Datagrid1.DataSource = ds.Tables[0].DefaultView; 源代码网推荐 int nRowCount = ds.Tables[0].Rows.Count ; 源代码网推荐 源代码网推荐 源代码网推荐 源代码网推荐 nPage = WFoot.Show(nPage,PAGE_SIZE,nRowCount); 源代码网推荐 Datagrid1.CurrentPageIndex = nPage - 1; 源代码网推荐 Datagrid1.DataBind(); 源代码网推荐 源代码网推荐 } 源代码网推荐 源代码网推荐 源代码网推荐 源代码网推荐 } 源代码网推荐 源代码网推荐 4, 例图 源代码网推荐 <img src="http://class.naea.edu.cn/Images/pagefoot.jpg"> 源代码网推荐 源代码网推荐 posted on 2004-02-17 10:57 木头象 阅读(727) 评论(1) 编辑 收藏 网摘 所属分类: asp.net 源代码网推荐 源代码网推荐 源代码网推荐 评论 源代码网推荐 # re: 带搜索的分页控件之二 2004-02-18 13:42 gujianxin 源代码网推荐 可能有的没有出来,那是因为DataGrid的设置有问题 源代码网推荐 <asp:datagrid id="Datagrid1" runat="server" AllowPaging="True" PageSize="15" BorderColor="#336666" 源代码网推荐 AutoGenerateColumns="False" Width="100%" BorderStyle="Double" BorderWidth="3px" 源代码网推荐 BackColor="White" CellPadding="4" GridLines="Horizontal"> 源代码网推荐 <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#339966"></SelectedItemStyle> 源代码网推荐 <ItemStyle ForeColor="#333333" BackColor="White"></ItemStyle> 源代码网推荐 <HeaderStyle Font-Size="10pt" Font-Bold="True" BorderWidth="5px" ForeColor="White" BorderColor="#CC9966" 源代码网推荐 BackColor="#336666"></HeaderStyle> 源代码网推荐 <FooterStyle ForeColor="#333333" BackColor="White"></FooterStyle> 源代码网推荐 <Columns> 源代码网推荐 <asp:BoundColumn DataField="dtHappenTime" HeaderText="出库时间" DataFormatString="{0:d}"></asp:BoundColumn> 源代码网推荐 <asp:BoundColumn DataField="nvchDeptName" HeaderText="移入部门"></asp:BoundColumn> 源代码网推荐 <asp:BoundColumn DataField="nvchMaster" HeaderText="负责人"></asp:BoundColumn> 源代码网推荐 </Columns> 源代码网推荐 <PagerStyle Visible="false" HorizontalAlign="Center" ForeColor="White" BackColor="#336666" Mode="NumericPages"></PagerStyle> 源代码网推荐 </asp:datagrid> 源代码网推荐 源代码网推荐 关键是AllowPaging="True" PageSize="15",要允许分页.至于PageSize可以用其他方法设置. 源代码网推荐 <PagerStyle Visible="false" .....> 使原来的分页控件不显示 源代码网推荐 源代码网推荐 做人要厚道,请注明转自酷网动力(www.ASPCOOL.COM)。 源代码网推荐 源代码网供稿. |
