快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

和记娱乐在线官网:Jquery+JSon实现的Asp.net无刷新分页控件



控件类代码:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Linq;

using System.Text;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Reflection;

using System.IO;

[assembly: WebResource("PageBarJS.js", "application/x-javascript")]

namespace Hawkon.Control {

[DefaultProperty("Text")]

[ToolboxData("")]

public class PageBar : We和记娱乐在线官网bControl {

[Bindable(true)]

[Category("Data")]

[DefaultValue("1")]

[Localizable(true)]

public int PageIndex {

get {

return pageIndex;

}

set {

pageIndex = value;

}

}

private int pageIndex;

[Bindable(true)]

[Category("Data")]

[DefaultValue("1")]

[Localizable(true)]

public int PageCount {

get {

return pageCount;

}

set {

pageCount = value;

}

}

private int pageCount;

[Bindable(true)]

[Category("Data")]

[DefaultValue("5")]

[Localiza和记娱乐在线官网ble(true)]

public int DisplayCount {

get {

return displayCount;

}

set {

displayCount = value;

}

}

private int displayCount;

protected override void RenderContents(HtmlTextWriter output) {

string html = "";

html += CreateA(1, "");

int b = 0, e = 0;

if (pageIndexdisplayCount) {

b = 1;

e = displayCount * 2 + 1;

}

else if (pageIndex > pageCount - displayCount) {

b = pageCount - displayCount * 2;

e = pageCount;

}

else {

b = pageIndex - displayCount;

e = pageIndex + displayCount;

}

if (b1) {

html += CreateA(1, "");

}

else

html += 和记娱乐在线官网Create和记娱乐在线官网A(b - 1, "");

for (int i = b; ie; i++) {

html += CreateA(i, i.ToString());

}

html += CreateA(e + 1, "");

html += CreateA(pageCount, ">>");

// html += string.Format("",

//this.Page.ClientScript.GetWebResourceUrl(typeof(PageBar), "JScript1.js"));

output.Write(html);

}

private string CreateA(int pageIndex, string text) {

if (pageIndex == this.pageIndex) {

return string.Format(""pageA\" title='页'id =\"{0}\">{1} ", pageIndex, text);

}

return string.Format(""pageA\" title='页' href=\"#\" id=\和记娱乐在线官网"{0}\">{1} ", pageIndex, text);

}

protected override void OnPreRender(EventArgs e) {

base.OnPreRender(e);

string resourceName = "PageBarJS.js";

string url = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "PageBarJS.js");

string script = "\r\n";

this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), resourceName, script, false);

script = @"";this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ready", script);

}

protected override void Render(HtmlTextWriter writer) {

base.Render(writer);

}

}

}

您可能还会对下面的文章感兴趣: