怎么从word复制过来没有换行呢?
解决方案 »
- 征求C#的输入与输出方法
- 怎么发贴子到CSDN主页哪个程序人生的栏目里啊??
- C#中WINFORM能不能开发画流程图那样程序并把结果保存到数据库
- silverlight访问WEB服务的跨域错误怎么解决?
- 多台计算机操作同一数据库,如何通知其他计算机数据库信息已更新?
- 高手,学习.net开发的路线?
- 如何判断当前系统是否使用XP界面主题风格?
- MDI编程:
- 如何在C#中定义键盘加速键?
- 如何在DataGrid中显示图表列表,在线等等!!!!!各位大侠该出手就出手!
- 对于Oracle日期格式处理,坐等~~UP!!~
- 做SMTP客户端遇到的问题:535 Error: authentication failed
using System;using System.Configuration;using System.Collections;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using PetShop.Components;
namespace PetShop.Web {
public class Search : System.Web.UI.Page { protected System.Web.UI.WebControls.Repeater list; protected System.Web.UI.WebControls.ImageButton btnPrevious; protected System.Web.UI.WebControls.ImageButton btnNext; protected System.Web.UI.HtmlControls.HtmlForm form; protected System.Web.UI.WebControls.HyperLink lnkPrevious; protected System.Web.UI.WebControls.HyperLink lnkNext; protected System.Web.UI.HtmlControls.HtmlGenericControl areaResult;
#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion
// constants const int pageSize = 4;
// page variables private int currentPage = 0; private int pageCount = 0; private int numResults = 0;
private void Page_Load(object sender, System.EventArgs e) { if (Page.IsPostBack == false) { // see what searching for string searchText = Request.QueryString["search_text"]; if ((searchText != string.Empty) && (searchText != null)) { // First time here we want to fetch the first page. All of the // other page requests will be handled through the page // navigation button event handlers. currentPage = 1; BindPagedData(); } else { // user did not enter a search string areaResult.InnerHtml = "No products were found."; list.Visible = false; } } }
// custom paging private void BindPagedData() { // pull the values off the query string if (Request.QueryString["requestedPage"] != null) { currentPage = System.Int32.Parse(Request.QueryString["requestedPage"]); pageCount = System.Int32.Parse(Request.QueryString["pageCount"]); } else currentPage = 1;
// get page of data and bind to list string searchText = Request.QueryString["search_text"]; Components.Product product = new Components.Product(); SearchResults[] results = product.Search(searchText, currentPage, pageSize, ref numResults);
list.DataSource = results; list.DataBind();
// if this is the first time, calculate the total number of pages if ((Page.IsPostBack == false) || (pageCount == 0)) pageCount = (int)System.Math.Ceiling((double)numResults / pageSize);
areaResult.InnerHtml = "Searching for <b>" + searchText + "</b> returned <b>" + numResults + "</b> items."; if (numResults == 0) list.Visible = false; // hide or show navigation buttons if (pageCount > 1) { // there are multiple pages lnkPrevious.Visible = currentPage > 1; lnkNext.Visible = currentPage < pageCount; lnkPrevious.NavigateUrl = "Search.aspx?search_text=" + searchText + "&requestedPage=" + (currentPage - 1) + "&pageCount=" + pageCount; lnkNext.NavigateUrl = "Search.aspx?search_text=" + searchText + "&requestedPage=" + (currentPage + 1) + "&pageCount=" + pageCount; } else { // there is only one page, hide both buttons lnkPrevious.Visible = lnkNext.Visible = false; lnkPrevious.NavigateUrl = "Search.aspx?search_text=" + searchText + "&requestedPage=" + (currentPage - 1) + "&pageCount=" + pageCount; lnkNext.NavigateUrl = "Search.aspx?search_text=" + searchText + "&requestedPage=" + (currentPage + 1) + "&pageCount=" + pageCount; } } }}
SearchResults[] results = product.Search(searchText, currentPage, pageSize, ref numResults);
执行分页查询